Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_typing.test_readonly_inheritance does not work correctly #128617

Closed
sobolevn opened this issue Jan 8, 2025 · 1 comment
Closed

test_typing.test_readonly_inheritance does not work correctly #128617

sobolevn opened this issue Jan 8, 2025 · 1 comment
Assignees
Labels
tests Tests in the Lib/test dir topic-typing type-bug An unexpected behavior, bug, or error

Comments

@sobolevn
Copy link
Member

sobolevn commented Jan 8, 2025

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

@sobolevn sobolevn added type-bug An unexpected behavior, bug, or error tests Tests in the Lib/test dir topic-typing labels Jan 8, 2025
@sobolevn sobolevn self-assigned this Jan 8, 2025
sobolevn added a commit to sobolevn/cpython that referenced this issue Jan 8, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Jan 8, 2025
…H-128618)

(cherry picked from commit 971a52b)

Co-authored-by: sobolevn <mail@sobolevn.me>
sobolevn added a commit that referenced this issue Jan 8, 2025
) (#128622)

gh-128617: Fix `test_typing.test_readonly_inheritance` (GH-128618)
(cherry picked from commit 971a52b)

Co-authored-by: sobolevn <mail@sobolevn.me>
@sobolevn
Copy link
Member Author

sobolevn commented Jan 8, 2025

typing_extensions backport PR: python/typing_extensions#526

@sobolevn sobolevn closed this as completed Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir topic-typing type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant
  NODES
COMMUNITY 2
Project 5
USERS 1