Skip to content

test_typing.test_readonly_inheritance does not work correctly #128617

@sobolevn

Description

@sobolevn

Bug report

def test_readonly_inheritance(self):
class Base1(TypedDict):
a: ReadOnly[int]
class Child1(Base1):
b: str
self.assertEqual(Child1.__readonly_keys__, frozenset({'a'}))
self.assertEqual(Child1.__mutable_keys__, frozenset({'b'}))
class Base2(TypedDict):
a: ReadOnly[int]
class Child2(Base2):
b: str
self.assertEqual(Child1.__readonly_keys__, frozenset({'a'}))
self.assertEqual(Child1.__mutable_keys__, frozenset({'b'}))

Notice that it always tests Child1 and never Child2

Refs df4784b

I will send a PR.

Linked PRs

Metadata

Metadata

Assignees

Labels

testsTests in the Lib/test dirtopic-typingtype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions