.. doctest::
- >>> from typing import ParamSpec
+ >>> from typing import ParamSpec, get_origin
>>> P = ParamSpec("P")
>>> get_origin(P.args) is P
True
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.
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
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