diff options
author | HongWeipeng <hongweichen8888@sina.com> | 2020-04-20 20:01:53 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-20 20:01:53 (GMT) |
commit | a25a04fea5446b1712cde0cff556574be139285a (patch) | |
tree | 934463e1c9cfd539287f99cd7fb496f141afa23a /Lib/test/test_typing.py | |
parent | eba9f6155df59c9beed97fb5764c9f01dd941af0 (diff) | |
download | cpython-a25a04fea5446b1712cde0cff556574be139285a.zip cpython-a25a04fea5446b1712cde0cff556574be139285a.tar.gz cpython-a25a04fea5446b1712cde0cff556574be139285a.tar.bz2 |
bpo-39942:Fix failure in `TypeVar` when missing `__name__` (GH-19616)
https://bugs.python.org/issue39942
Diffstat (limited to 'Lib/test/test_typing.py')
-rw-r--r-- | Lib/test/test_typing.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py index 489836c..b3a6717 100644 --- a/Lib/test/test_typing.py +++ b/Lib/test/test_typing.py @@ -221,6 +221,13 @@ class TypeVarTests(BaseTestCase): with self.assertRaises(TypeError): TypeVar('X', str, float, bound=Employee) + def test_missing__name__(self): + # See bpo-39942 + code = ("import typing\n" + "T = typing.TypeVar('T')\n" + ) + exec(code, {}) + def test_no_bivariant(self): with self.assertRaises(ValueError): TypeVar('T', covariant=True, contravariant=True) |