MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / test_path_deepcopy_cycle

Function test_path_deepcopy_cycle

lib/matplotlib/tests/test_path.py:376–400  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

374
375
376def test_path_deepcopy_cycle():
377 class PathWithCycle(Path):
378 def __init__(self, *args, **kwargs):
379 super().__init__(*args, **kwargs)
380 self.x = self
381
382 p = PathWithCycle([[0, 0], [1, 1]], readonly=True)
383 p_copy = p.deepcopy()
384 assert p_copy is not p
385 assert p.readonly
386 assert not p_copy.readonly
387 assert p_copy.x is p_copy
388
389 class PathWithCycle2(Path):
390 def __init__(self, *args, **kwargs):
391 super().__init__(*args, **kwargs)
392 self.x = [self] * 2
393
394 p2 = PathWithCycle2([[0, 0], [1, 1]], readonly=True)
395 p2_copy = p2.deepcopy()
396 assert p2_copy is not p2
397 assert p2.readonly
398 assert not p2_copy.readonly
399 assert p2_copy.x[0] is p2_copy
400 assert p2_copy.x[1] is p2_copy
401
402
403def test_path_shallowcopy():

Callers

nothing calls this directly

Calls 3

PathWithCycleClass · 0.85
PathWithCycle2Class · 0.85
deepcopyMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…