Thanks to visit codestin.com
Credit goes to github.com

Skip to content

gh-112155: Run typing.py doctests during tests #112156

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

Merged
merged 4 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Lib/test/test_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
4 changes: 2 additions & 2 deletions Lib/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand Down