mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
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:
parent
6f9ca53a6a
commit
a468866a67
1 changed files with 6 additions and 0 deletions
|
|
@ -3104,6 +3104,12 @@ def test_get_type_hints_classes(self):
|
||||||
'my_inner_a2': mod_generics_cache.B.A,
|
'my_inner_a2': mod_generics_cache.B.A,
|
||||||
'my_outer_a': mod_generics_cache.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):
|
def test_respect_no_type_check(self):
|
||||||
@no_type_check
|
@no_type_check
|
||||||
class NoTpCheck:
|
class NoTpCheck:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue