summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_typing.py
diff options
context:
space:
mode:
authorYurii Karabas <1998uriyyo@gmail.com>2021-07-19 17:22:12 (GMT)
committerGitHub <noreply@github.com>2021-07-19 17:22:12 (GMT)
commitbce1418541a64a793960182772f985f64afbfa1a (patch)
treecfde24e8cb3ad119a55282e54f4b052f8be468d9 /Lib/test/test_typing.py
parent89f4c34797de2f0e5045da2b97c1c8cbbb42fbb2 (diff)
downloadcpython-bce1418541a64a793960182772f985f64afbfa1a.zip
cpython-bce1418541a64a793960182772f985f64afbfa1a.tar.gz
cpython-bce1418541a64a793960182772f985f64afbfa1a.tar.bz2
bpo-44524: Add missed __name__ and __qualname__ to typing module objects (#27237)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Diffstat (limited to 'Lib/test/test_typing.py')
-rw-r--r--Lib/test/test_typing.py61
1 files changed, 61 insertions, 0 deletions
diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py
index da6775e..b696447 100644
--- a/Lib/test/test_typing.py
+++ b/Lib/test/test_typing.py
@@ -4498,6 +4498,67 @@ class TypeGuardTests(BaseTestCase):
issubclass(int, TypeGuard)
+class SpecialAttrsTests(BaseTestCase):
+ def test_special_attrs(self):
+ cls_to_check = (
+ # ABC classes
+ typing.AbstractSet,
+ typing.AsyncContextManager,
+ typing.AsyncGenerator,
+ typing.AsyncIterable,
+ typing.AsyncIterator,
+ typing.Awaitable,
+ typing.ByteString,
+ typing.Callable,
+ typing.ChainMap,
+ typing.Collection,
+ typing.Container,
+ typing.ContextManager,
+ typing.Coroutine,
+ typing.Counter,
+ typing.DefaultDict,
+ typing.Deque,
+ typing.Dict,
+ typing.FrozenSet,
+ typing.Generator,
+ typing.Hashable,
+ typing.ItemsView,
+ typing.Iterable,
+ typing.Iterator,
+ typing.KeysView,
+ typing.List,
+ typing.Mapping,
+ typing.MappingView,
+ typing.MutableMapping,
+ typing.MutableSequence,
+ typing.MutableSet,
+ typing.OrderedDict,
+ typing.Reversible,
+ typing.Sequence,
+ typing.Set,
+ typing.Sized,
+ typing.Tuple,
+ typing.Type,
+ typing.ValuesView,
+ # Special Forms
+ typing.Any,
+ typing.NoReturn,
+ typing.ClassVar,
+ typing.Final,
+ typing.Union,
+ typing.Optional,
+ typing.Literal,
+ typing.TypeAlias,
+ typing.Concatenate,
+ typing.TypeGuard,
+ )
+
+ for cls in cls_to_check:
+ with self.subTest(cls=cls):
+ self.assertEqual(cls.__name__, cls._name)
+ self.assertEqual(cls.__qualname__, cls._name)
+ self.assertEqual(cls.__module__, 'typing')
+
class AllTests(BaseTestCase):
"""Tests for __all__."""