Skip to content

typing, annotationlib: clean tests #133087

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 3 commits into from
Apr 28, 2025
Merged

Conversation

JelleZijlstra
Copy link
Member

  • Add @cpython_only decorator to lazy import tests
  • Rename reference to SOURCE format
  • Always two newlines between test case classes
  • Merge two classes of ForwardRef tests
  • Use get_annotations instead of annotationlib.get_annotations
  • Format test_annotationlib with Black (not expecting that we'll keep this up
    but it's close to Black-formatted right now)
  • Reduce usage of assertTrue/assertFalse. These do truthiness checks, not is checks against True/False, so they could hide issues if our code sets some attributes to some other object instead of a bool. I left assertTrue/assertFalse when calling functions like callable() that are tested elsewhere.

- Add @cpython_only decorator to lazy import tests
- Rename reference to SOURCE format
- Always two newlines between test case classes
- Merge two classes of ForwardRef tests
- Use get_annotations instead of annotationlib.get_annotations
- Format test_annotationlib with Black (not expecting that we'll keep this up
  but it's close to Black-formatted right now)
@JelleZijlstra
Copy link
Member Author

Let me know if there's other pieces of minor cleanup we could do on the tests.

@@ -6124,8 +6130,6 @@ def test_errors(self):


# We need this to make sure that `@no_type_check` respects `__module__` attr:
Copy link
Member

Choose a reason for hiding this comment

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

this comment seems orphaned now?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it still makes sense referring to the classes immediately below

@JelleZijlstra JelleZijlstra merged commit 7f16f1b into python:main Apr 28, 2025
50 checks passed
@JelleZijlstra JelleZijlstra deleted the clean-tests branch April 28, 2025 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip issue skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants