summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikita Sobolev <mail@sobolevn.me>2023-11-16 15:40:09 (GMT)
committerGitHub <noreply@github.com>2023-11-16 15:40:09 (GMT)
commit7680da458398c5a08b9c32785b1eeb7b7c0887e4 (patch)
treeb52152330b1ad9c858fe2315195e9173f58d4a5b
parent12c7e9d573de57343cf018fb4e67521aba46c90f (diff)
downloadcpython-7680da458398c5a08b9c32785b1eeb7b7c0887e4.zip
cpython-7680da458398c5a08b9c32785b1eeb7b7c0887e4.tar.gz
cpython-7680da458398c5a08b9c32785b1eeb7b7c0887e4.tar.bz2
gh-112155: Run `typing.py` doctests as part of `test_typing` (#112156)
-rw-r--r--Lib/test/test_typing.py6
-rw-r--r--Lib/typing.py4
2 files changed, 8 insertions, 2 deletions
diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py
index 1e812e1..8681e7e 100644
--- a/Lib/test/test_typing.py
+++ b/Lib/test/test_typing.py
@@ -9464,5 +9464,11 @@ class TypeIterationTests(BaseTestCase):
self.assertNotIsInstance(type_to_test, collections.abc.Iterable)
+def load_tests(loader, tests, pattern):
+ import doctest
+ tests.addTests(doctest.DocTestSuite(typing))
+ return tests
+
+
if __name__ == '__main__':
main()
diff --git a/Lib/typing.py b/Lib/typing.py
index 3493257..5e3e1f2 100644
--- a/Lib/typing.py
+++ b/Lib/typing.py
@@ -3404,8 +3404,8 @@ def get_protocol_members(tp: type, /) -> 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.
"""