Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/test_typing_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5251,6 +5251,11 @@ def test_nested_annotated_with_unhashable_metadata(self):
self.assertEqual(X.__origin__, List[Annotated[str, {"unhashable_metadata"}]])
self.assertEqual(X.__metadata__, ("metadata",))

def test_compatibility(self):
# Test that the _AnnotatedAlias compatibility alias works
self.assertTrue(hasattr(typing_extensions, "_AnnotatedAlias"))
self.assertIs(typing_extensions._AnnotatedAlias, typing._AnnotatedAlias)


class GetTypeHintsTests(BaseTestCase):
def test_get_type_hints(self):
Expand Down
5 changes: 4 additions & 1 deletion src/typing_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4095,7 +4095,7 @@ def evaluate_forward_ref(
)


# Aliases for items that have always been in typing.
# Aliases for items that are in typing in all supported versions.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Unrelated but this statement wasn't accurate any more

# Explicitly assign these (rather than using `from typing import *` at the top),
# so that we get a CI error if one of these is deleted from typing.py
# in a future version of Python
Expand Down Expand Up @@ -4136,3 +4136,6 @@ def evaluate_forward_ref(
cast = typing.cast
no_type_check = typing.no_type_check
no_type_check_decorator = typing.no_type_check_decorator
# This is private, but it was defined by typing_extensions for a long time
# and some users rely on it.
_AnnotatedAlias = typing._AnnotatedAlias
Loading