]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-112155: Run `typing.py` doctests as part of `test_typing` (#112156)
authorNikita Sobolev <mail@sobolevn.me>
Thu, 16 Nov 2023 15:40:09 +0000 (18:40 +0300)
committerGitHub <noreply@github.com>
Thu, 16 Nov 2023 15:40:09 +0000 (15:40 +0000)
Lib/test/test_typing.py
Lib/typing.py

index 1e812e1d525a810cd05bb212174db3b8837225a3..8681e7efba3244fa08a61280058e6d30a6100574 100644 (file)
@@ -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()
index 3493257677c7ff5d9f5f43909d24963388a32b70..5e3e1f298295c79d7ee8ebcee5c4b54ac98de5c0 100644 (file)
@@ -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.
     """