From d80ed13d4ec0961fde1d814e5a101e20166a24b8 Mon Sep 17 00:00:00 2001 From: Jan-Eric Nitschke <47750513+JanEricNitschke@users.noreply.github.com> Date: Sat, 13 Sep 2025 11:07:19 +0200 Subject: [PATCH 1/3] Fix doctest for get_protocol_members --- CHANGELOG.md | 1 + src/typing_extensions.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 733505a5..6c8b988c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Unreleased +- Fix doctest of `typing_extensions.get_protocol_members`. - Fix incorrect behaviour on Python 3.9 and Python 3.10 that meant that calling `isinstance` with `typing_extensions.Concatenate[...]` or `typing_extensions.Unpack[...]` as the first argument could have a different diff --git a/src/typing_extensions.py b/src/typing_extensions.py index bd67a80a..03b72e3b 100644 --- a/src/typing_extensions.py +++ b/src/typing_extensions.py @@ -3864,8 +3864,8 @@ def get_protocol_members(tp: type, /) -> typing.FrozenSet[str]: >>> class P(Protocol): ... def a(self) -> str: ... ... b: int - >>> get_protocol_members(P) - frozenset({'a', 'b'}) + >>> get_protocol_members(P) == frozenset({'a', 'b'}) + True Raise a TypeError for arguments that are not Protocols. """ From d2d1ea006a9f8f203172481c34eb66837e9e3ada Mon Sep 17 00:00:00 2001 From: Jan-Eric Nitschke <47750513+JanEricNitschke@users.noreply.github.com> Date: Sat, 13 Sep 2025 12:09:35 +0200 Subject: [PATCH 2/3] Also run doctests in CI --- src/test_typing_extensions.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/test_typing_extensions.py b/src/test_typing_extensions.py index 88fa699e..27f4059c 100644 --- a/src/test_typing_extensions.py +++ b/src/test_typing_extensions.py @@ -9574,6 +9574,10 @@ def test_sentinel_not_picklable(self): ): pickle.dumps(sentinel) +def load_tests(loader, tests, pattern): + import doctest + tests.addTests(doctest.DocTestSuite(typing_extensions)) + return tests if __name__ == '__main__': # pragma: no cover main() From 9a77b158c1820c7457d78292185552e349f70319 Mon Sep 17 00:00:00 2001 From: Jan-Eric Nitschke <47750513+JanEricNitschke@users.noreply.github.com> Date: Mon, 15 Sep 2025 16:59:46 +0200 Subject: [PATCH 3/3] Remove changelog entry --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c8b988c..733505a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,5 @@ # Unreleased -- Fix doctest of `typing_extensions.get_protocol_members`. - Fix incorrect behaviour on Python 3.9 and Python 3.10 that meant that calling `isinstance` with `typing_extensions.Concatenate[...]` or `typing_extensions.Unpack[...]` as the first argument could have a different