mirror of https://github.com/python/cpython
bpo-46345: Add a test case for implicit `Optional` class attribute (GH-30535)
This commit is contained in:
parent
ed57b36c32
commit
1de60155d5
|
@ -3177,6 +3177,12 @@ class GetTypeHintTests(BaseTestCase):
|
|||
'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:
|
||||
|
|
Loading…
Reference in New Issue