]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-149410: Test that `typing.NoDefault` is final (GH-149411) (#149420)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 5 May 2026 15:22:48 +0000 (17:22 +0200)
committerGitHub <noreply@github.com>
Tue, 5 May 2026 15:22:48 +0000 (15:22 +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 c3930252948fd9f10384aac9c68130324b38da93..1372452253fcedb1da30c33d5c372dd3efdf9f56 100644 (file)
@@ -10570,6 +10570,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__."""