Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR extends the container’s type standardization to handle PEP-695 style type Alias declarations and adds tests to verify that injecting type aliases (including generic ones) resolves correctly.
- Added two new tests in
test_injectable.pyfor plain and generic type aliases. - Updated
__standardize_inputsto return the raw iterator fromstandardize_typesinstead of materializing a tuple. - Enhanced
standardize_typesto recursively expandTypeAliasTypevalues.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/test_injectable.py | Added tests for injecting both simple and generic type aliases. |
| injection/_core/module.py | Changed __standardize_inputs to return an Iterator directly. |
| injection/_core/common/type.py | Expanded alias handling in standardize_types with recursion. |
Comments suppressed due to low confidence (2)
tests/test_injectable.py:198
- [nitpick] It would be valuable to add a test for nested type aliases (e.g.
type Alias2 = Alias) to ensure recursive alias expansion works correctly.
def test_injectable_with_type_alias_type(self):
injection/_core/module.py:351
- Switching from a tuple to a raw iterator means the result can only be consumed once. If consumers expect to iterate multiple times, consider wrapping this call in
tuple()or documenting its single-use nature.
return standardize_types(*classes, with_origin=True)
added 2 commits
June 12, 2025 10:07
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.