]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] gh-149410: Test that `typing.NoDefault` is final (GH-149411) (#149419)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 5 May 2026 15:25:23 +0000 (17:25 +0200)
committerGitHub <noreply@github.com>
Tue, 5 May 2026 15:25:23 +0000 (15:25 +0000)
gh-149410: Test that `typing.NoDefault` is final (GH-149411)
(cherry picked from commit bad9296fb0424bc480fa0ecfd2d60f73c33358f5)

Co-authored-by: sobolevn <mail@sobolevn.me>
Lib/test/test_typing.py

index 2c6a5c7466032d9689311c59c97716185de56b47..2c99b221e52d1f1c1fb9a18026231127aa683d73 100644 (file)
@@ -10859,6 +10859,10 @@ class NoDefaultTests(BaseTestCase):
         with self.assertRaises(AttributeError):
             type(NoDefault).foo
 
+    def test_no_subclassing(self):
+        with self.assertRaises(TypeError):
+            class Test(type(NoDefault)): ...
+
 
 class AllTests(BaseTestCase):
     """Tests for __all__."""