]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-111681: minor fixes to typing doctests; remove unused imports in `test_typing...
authorNikita Sobolev <mail@sobolevn.me>
Fri, 3 Nov 2023 12:23:33 +0000 (15:23 +0300)
committerGitHub <noreply@github.com>
Fri, 3 Nov 2023 12:23:33 +0000 (12:23 +0000)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Doc/library/typing.rst
Lib/test/test_typing.py

index bdff2bb776d84481032478b5f45930fecb064821..f82f53514a71dc0f46bff85bf9983b87739a691c 100644 (file)
@@ -1954,7 +1954,7 @@ without the dedicated syntax, as documented below.
 
    .. doctest::
 
-      >>> from typing import ParamSpec
+      >>> from typing import ParamSpec, get_origin
       >>> P = ParamSpec("P")
       >>> get_origin(P.args) is P
       True
@@ -3059,14 +3059,14 @@ Introspection helpers
 
    Return the set of members defined in a :class:`Protocol`.
 
-   ::
+   .. doctest::
 
       >>> from typing import Protocol, get_protocol_members
       >>> 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 :exc:`TypeError` for arguments that are not Protocols.
 
index 7f60bf4bbc1e756a29cdefc6553dcd19fef942a4..9dd637b974769c844fd60f7511d9b9d82896e97e 100644 (file)
@@ -9,8 +9,7 @@ import itertools
 import pickle
 import re
 import sys
-import warnings
-from unittest import TestCase, main, skipUnless, skip
+from unittest import TestCase, main, skip
 from unittest.mock import patch
 from copy import copy, deepcopy
 
@@ -45,7 +44,7 @@ import typing
 import weakref
 import types
 
-from test.support import import_helper, captured_stderr, cpython_only
+from test.support import captured_stderr, cpython_only
 from test import mod_generics_cache
 from test import _typed_dict_helper