MCPcopy Index your code
hub / github.com/python/cpython / test_copy_and_deepcopy

Method test_copy_and_deepcopy

Lib/test/test_typing.py:5442–5455  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

5440 del PP
5441
5442 def test_copy_and_deepcopy(self):
5443 T = TypeVar('T')
5444 class Node(Generic[T]): ...
5445 things = [Union[T, int], Tuple[T, int], Tuple[()],
5446 Callable[..., T], Callable[[int], int],
5447 Tuple[Any, Any], Node[T], Node[int], Node[Any], typing.Iterable[T],
5448 typing.Iterable[Any], typing.Iterable[int], typing.Dict[int, str],
5449 typing.Dict[T, Any], ClassVar[int], ClassVar[List[T]], Tuple['T', 'T'],
5450 Union['T', int], List['T'], typing.Mapping['T', int],
5451 Union[b"x", b"y"], Any]
5452 for t in things:
5453 with self.subTest(thing=t):
5454 self.assertEqual(t, copy(t))
5455 self.assertEqual(t, deepcopy(t))
5456
5457 def test_immutability_by_copy_and_pickle(self):
5458 # Special forms like Union, Any, etc., generic aliases to containers like List,

Callers

nothing calls this directly

Calls 4

copyFunction · 0.90
deepcopyFunction · 0.90
subTestMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected