Add test checking value of a TypedDict's __total__ attribute when the… · python/cpython@d8ce092

Original file line numberDiff line numberDiff line change

@@ -8479,6 +8479,22 @@ class TD2(TD1):

84798479
84808480

self.assertIs(TD2.__total__, True)

84818481
8482+

def test_total_with_assigned_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)

8497+
84828498

def test_optional_keys(self):

84838499

class Point2Dor3D(Point2D, total=False):

84848500

z: int