]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-107909: Test explicit `object` base in PEP695 generic classes (#108001)
authorNikita Sobolev <mail@sobolevn.me>
Wed, 16 Aug 2023 13:30:03 +0000 (16:30 +0300)
committerGitHub <noreply@github.com>
Wed, 16 Aug 2023 13:30:03 +0000 (06:30 -0700)
Lib/test/test_type_params.py

index bced641a9661fd7b1a509cfe5e11a34e328b795b..0045057f181e1c029dc4399c4dd00297a24274af 100644 (file)
@@ -148,6 +148,10 @@ class TypeParamsInvalidTest(unittest.TestCase):
         check_syntax_error(self, "def f[T: [(x := 3) for _ in range(2)]](): pass")
         check_syntax_error(self, "type T = [(x := 3) for _ in range(2)]")
 
+    def test_incorrect_mro_explicit_object(self):
+        with self.assertRaisesRegex(TypeError, r"\(MRO\) for bases object, Generic"):
+            class My[X](object): ...
+
 
 class TypeParamsNonlocalTest(unittest.TestCase):
     def test_nonlocal_disallowed_01(self):