Skip to content

Commit eebecfb

Browse files
committed
test: Assignment to a __total__ key in class body
In relation to python#109544 which changed this behavior. Signed-off-by: Daniel Sperber <[email protected]>
1 parent 65b339c commit eebecfb

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Lib/test/test_typing.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8478,6 +8478,22 @@ class TD2(TD1):
84788478
b: str
84798479

84808480
self.assertIs(TD2.__total__, True)
8481+
8482+
def test_total_with_value(self):
8483+
class TD(TypedDict):
8484+
__total__ = "some_value"
8485+
8486+
self.assertIs(TD.__total__, True)
8487+
8488+
class TD2(TypedDict, total=True):
8489+
__total__ = "some_value"
8490+
8491+
self.assertIs(TD2.__total__, True)
8492+
8493+
class TD3(TypedDict, total=False):
8494+
__total__ = "some value"
8495+
8496+
self.assertIs(TD3.__total__, False)
84818497

84828498
def test_optional_keys(self):
84838499
class Point2Dor3D(Point2D, total=False):

0 commit comments

Comments
 (0)