Skip to content

Commit

Permalink
bpo-46345: Add a test case for implicit Optional class attribute (G…
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolevn authored Jan 12, 2022
1 parent ed57b36 commit 1de6015
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Lib/test/test_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -3177,6 +3177,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:
Expand Down

0 comments on commit 1de6015

Please sign in to comment.