summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_typing.py
diff options
context:
space:
mode:
authorNikita Sobolev <mail@sobolevn.me>2021-10-21 20:16:50 (GMT)
committerGitHub <noreply@github.com>2021-10-21 20:16:50 (GMT)
commit0c4c2e6213f348dc98a787e385cde0a480e80ee9 (patch)
tree59814f9ece2edae8b66cf64649055c7e0eab2905 /Lib/test/test_typing.py
parent311910b31a4bd94dc79298388b7cb65ca5546438 (diff)
downloadcpython-0c4c2e6213f348dc98a787e385cde0a480e80ee9.zip
cpython-0c4c2e6213f348dc98a787e385cde0a480e80ee9.tar.gz
cpython-0c4c2e6213f348dc98a787e385cde0a480e80ee9.tar.bz2
Move several typing tests to a proper class, refs GH-28563 (GH-29126)
Diffstat (limited to 'Lib/test/test_typing.py')
-rw-r--r--Lib/test/test_typing.py32
1 files changed, 16 insertions, 16 deletions
diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py
index 032fe91..b1414dc 100644
--- a/Lib/test/test_typing.py
+++ b/Lib/test/test_typing.py
@@ -3282,6 +3282,22 @@ class GetTypeHintTests(BaseTestCase):
self.assertNotIn('bad', sys.modules)
self.assertEqual(get_type_hints(BadType), {'foo': tuple, 'bar': list})
+ def test_forward_ref_and_final(self):
+ # https://bugs.python.org/issue45166
+ hints = get_type_hints(ann_module5)
+ self.assertEqual(hints, {'name': Final[str]})
+
+ hints = get_type_hints(ann_module5.MyClass)
+ self.assertEqual(hints, {'value': Final})
+
+ def test_top_level_class_var(self):
+ # https://bugs.python.org/issue45166
+ with self.assertRaisesRegex(
+ TypeError,
+ r'typing.ClassVar\[int\] is not valid as type argument',
+ ):
+ get_type_hints(ann_module6)
+
class GetUtilitiesTestCase(TestCase):
def test_get_origin(self):
@@ -3345,22 +3361,6 @@ class GetUtilitiesTestCase(TestCase):
(Concatenate[int, P], int))
self.assertEqual(get_args(list | str), (list, str))
- def test_forward_ref_and_final(self):
- # https://bugs.python.org/issue45166
- hints = get_type_hints(ann_module5)
- self.assertEqual(hints, {'name': Final[str]})
-
- hints = get_type_hints(ann_module5.MyClass)
- self.assertEqual(hints, {'value': Final})
-
- def test_top_level_class_var(self):
- # https://bugs.python.org/issue45166
- with self.assertRaisesRegex(
- TypeError,
- r'typing.ClassVar\[int\] is not valid as type argument',
- ):
- get_type_hints(ann_module6)
-
class CollectionsAbcTests(BaseTestCase):