gh-112155: Run typing.py doctests as part of test_typing (#112156)

This commit is contained in:
Nikita Sobolev 2023-11-16 18:40:09 +03:00 committed by GitHub
parent 12c7e9d573
commit 7680da4583
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View file

@ -9464,5 +9464,11 @@ def test_is_not_instance_of_iterable(self):
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()

View 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.
"""