mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
bpo-46345: Add a test case for implicit Optional
class attribute (GH-30535)
This commit is contained in:
parent
ed57b36c32
commit
1de60155d5
1 changed files with 6 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue