bpo-46345: Add a test case for implicit Optional class attribute (GH-30535)

(cherry picked from commit 1de60155d5)

Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
This commit is contained in:
Miss Islington (bot) 2022-01-12 17:45:49 -08:00 committed by GitHub
parent 6f9ca53a6a
commit a468866a67
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3104,6 +3104,12 @@ def test_get_type_hints_classes(self):
'my_inner_a2': mod_generics_cache.B.A,
'my_outer_a': mod_generics_cache.A})
def test_get_type_hints_classes_no_implicit_optional(self):
class WithNoneDefault:
field: int = None # most type-checkers won't be happy with it
self.assertEqual(gth(WithNoneDefault), {'field': int})
def test_respect_no_type_check(self):
@no_type_check
class NoTpCheck: