aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_typing.py
diff options
context:
space:
mode:
authorNikita Sobolev <mail@sobolevn.me>2022-08-30 20:36:16 +0300
committerGitHub <noreply@github.com>2022-08-30 10:36:16 -0700
commit4217393aeed42d67dd4b16a128528f5ca8d939c4 (patch)
treece66e2cf6cc4cd318b1eaaf77d7e6984fb80b192 /Lib/test/test_typing.py
parent6d791a97364b68d5f9c3514a0470aac487fc538d (diff)
downloadcpython-4217393aeed42d67dd4b16a128528f5ca8d939c4.tar.gz
cpython-4217393aeed42d67dd4b16a128528f5ca8d939c4.zip
gh-95987: Fix `repr` of `Any` type subclasses (#96412)
Diffstat (limited to 'Lib/test/test_typing.py')
-rw-r--r--Lib/test/test_typing.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py
index 7eea01909ec..9239673c248 100644
--- a/Lib/test/test_typing.py
+++ b/Lib/test/test_typing.py
@@ -113,6 +113,12 @@ class AnyTests(BaseTestCase):
def test_repr(self):
self.assertEqual(repr(Any), 'typing.Any')
+ class Sub(Any): pass
+ self.assertEqual(
+ repr(Sub),
+ "<class 'test.test_typing.AnyTests.test_repr.<locals>.Sub'>",
+ )
+
def test_errors(self):
with self.assertRaises(TypeError):
issubclass(42, Any)