summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_typing.py
diff options
context:
space:
mode:
authorJelle Zijlstra <jelle.zijlstra@gmail.com>2023-09-20 03:15:52 (GMT)
committerGitHub <noreply@github.com>2023-09-20 03:15:52 (GMT)
commit1293fcc3c6b67b7e8d0081863ec6387e162341eb (patch)
treede2a66545d74384fd8403c2cf66d375ab3601a76 /Lib/test/test_typing.py
parent81cd1bd713624c3d26b647f3d28f2fd905887a0d (diff)
downloadcpython-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.py11
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