]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-74690: Make a typing test more resilient (#104691)
authorAlex Waygood <Alex.Waygood@Gmail.com>
Sun, 21 May 2023 00:13:37 +0000 (01:13 +0100)
committerGitHub <noreply@github.com>
Sun, 21 May 2023 00:13:37 +0000 (17:13 -0700)
Lib/test/test_typing.py

index 6459fa3eb96a6075a66b5b186435821f50f91b93..9a3e64289ee8778d97dd69232959fa92b3383453 100644 (file)
@@ -3154,10 +3154,10 @@ class ProtocolTests(BaseTestCase):
 
         class NonPR(PR): pass
 
-        class C:
+        class C(metaclass=abc.ABCMeta):
             x = 1
 
-        class D:
+        class D(metaclass=abc.ABCMeta):
             def meth(self): pass
 
         self.assertNotIsInstance(C(), NonP)
@@ -3174,8 +3174,7 @@ class ProtocolTests(BaseTestCase):
 
         acceptable_extra_attrs = {
             '_is_protocol', '_is_runtime_protocol', '__parameters__',
-            '__subclasshook__', '__abstractmethods__', '_abc_impl',
-            '__init__', '__annotations__',
+            '__init__', '__annotations__', '__subclasshook__',
         }
         self.assertLessEqual(vars(NonP).keys(), vars(C).keys() | acceptable_extra_attrs)
         self.assertLessEqual(