8000 gh-111681: minor fixes to typing doctests; remove unused imports in `… · python/cpython@ccc8caa · GitHub
[go: up one dir, main page]

Skip to content

Commit ccc8caa

Browse files
gh-111681: minor fixes to typing doctests; remove unused imports in test_typing (#111682)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
1 parent 24ddaee commit ccc8caa

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

Doc/library/typing.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1954,7 +1954,7 @@ without the dedicated syntax, as documented below.
19541954

19551955
.. doctest::
19561956

1957-
>>> from typing import ParamSpec
1957+
>>> from typing import ParamSpec, get_origin
19581958
>>> P = ParamSpec("P")
19591959
>>> get_origin(P.args) is P
19601960
True
@@ -3059,14 +3059,14 @@ Introspection helpers
30593059

30603060
Return the set of members defined in a :class:`Protocol`.
30613061

3062-
::
3062+
.. doctest::
30633063

30643064
>>> from typing import Protocol, get_protocol_members
30653065
>>> class P(Protocol):
30663066
... def a(self) -> str: ...
30673067
... b: int
3068-
>>> get_protocol_members(P)
3069-
frozenset({'a', 'b'})
3068+
>>> get_protocol_members(P) == frozenset({'a', 'b'})
3069+
True
30703070

30713071
Raise :exc:`TypeError` for arguments that are not Protocols.
30723072

Lib/test/test_typing.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
import pickle
1010
import re
1111
import sys
12-
import warnings
13-
from unittest import TestCase, main, skipUnless, skip
12+
from unittest import TestCase, main, skip
1413
from unittest.mock import patch
1514
from copy import copy, deepcopy
1615

@@ -45,7 +44,7 @@
4544
import weakref
4645
import types
4746

48-
from test.support import import_helper, captured_stderr, cpython_only
47+
from test.support import captured_stderr, cpython_only
4948
from test import mod_generics_cache
5049
from test import _typed_dict_helper
5150

0 commit comments

Comments
 (0)
0