Skip to content

bpo-46603: improve coverage of typing._strip_annotations #31063

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 19, 2022

Conversation

sobolevn
Copy link
Member

@sobolevn sobolevn commented Feb 1, 2022

It was not covered at all, proof:

Снимок экрана 2022-02-02 в 0 05 19

It took me some time to understand how can I possibly reach it. After adding this test, we now cover this path. Proof:

Снимок экрана 2022-02-02 в 0 11 25

https://bugs.python.org/issue46603

@@ -3355,6 +3355,15 @@ def barfoo4(x: BA3): ...
{"x": typing.Annotated[int | float, "const"]}
)

def test_get_type_hints_annotated_in_union(self): # bpo-46603
def with_union(x: int | list[Annotated[str, 'meta']]): ...
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are all the other paths covered already? This test doesn't seem to cover the _GenericAlias branch in _strip_annotations.

Copy link
Member Author

@sobolevn sobolevn Feb 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, other branches are reported to be covered by other tests in test_typing somewhere.

@JelleZijlstra JelleZijlstra added needs backport to 3.9 only security fixes needs backport to 3.10 only security fixes labels Feb 17, 2022
Copy link
Member

@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Planning to merge in a few days (cc @gvanrossum).

Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG

@JelleZijlstra JelleZijlstra merged commit 25c0b9d into python:main Feb 19, 2022
@miss-islington
Copy link
Contributor

Thanks @sobolevn for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9, 3.10.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 19, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 19, 2022
@bedevere-bot bedevere-bot removed the needs backport to 3.10 only security fixes label Feb 19, 2022
@bedevere-bot
Copy link

GH-31423 is a backport of this pull request to the 3.10 branch.

@bedevere-bot
Copy link

GH-31424 is a backport of this pull request to the 3.9 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.9 only security fixes label Feb 19, 2022
miss-islington added a commit that referenced this pull request Feb 19, 2022
(cherry picked from commit 25c0b9d)

Co-authored-by: Nikita Sobolev <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants