diff options
author | Jelle Zijlstra <jelle.zijlstra@gmail.com> | 2023-09-20 03:15:52 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-20 03:15:52 (GMT) |
commit | 1293fcc3c6b67b7e8d0081863ec6387e162341eb (patch) | |
tree | de2a66545d74384fd8403c2cf66d375ab3601a76 /Lib/test/test_typing.py | |
parent | 81cd1bd713624c3d26b647f3d28f2fd905887a0d (diff) | |
download | cpython-1293fcc3c6b67b7e8d0081863ec6387e162341eb.zip cpython-1293fcc3c6b67b7e8d0081863ec6387e162341eb.tar.gz cpython-1293fcc3c6b67b7e8d0081863ec6387e162341eb.tar.bz2 |
gh-109543: Remove unnecessary hasattr check (#109544)
Also added a new test case covering the scenario I thought this
might be about.
Diffstat (limited to 'Lib/test/test_typing.py')
-rw-r--r-- | Lib/test/test_typing.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py index 69f5ff9..4d1c0f2 100644 --- a/Lib/test/test_typing.py +++ b/Lib/test/test_typing.py @@ -7586,6 +7586,17 @@ class TypedDictTests(BaseTestCase): self.assertEqual(Options.__required_keys__, frozenset()) self.assertEqual(Options.__optional_keys__, {'log_level', 'log_path'}) + def test_total_inherits_non_total(self): + class TD1(TypedDict, total=False): + a: int + + self.assertIs(TD1.__total__, False) + + class TD2(TD1): + b: str + + self.assertIs(TD2.__total__, True) + def test_optional_keys(self): class Point2Dor3D(Point2D, total=False): z: int |