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

Function test_interpolated_closepoly

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

Source from the content-addressed store, hash-verified

632
633
634def test_interpolated_closepoly():
635 codes = [Path.MOVETO] + [Path.LINETO]*2 + [Path.CLOSEPOLY]
636 vertices = [(4, 3), (5, 4), (5, 3), (0, 0)]
637
638 path = Path(vertices, codes)
639 result = path.interpolated(2)
640
641 expected_vertices = np.array([[4, 3],
642 [4.5, 3.5],
643 [5, 4],
644 [5, 3.5],
645 [5, 3],
646 [4.5, 3],
647 [4, 3]])
648 expected_codes = [Path.MOVETO] + [Path.LINETO]*5 + [Path.CLOSEPOLY]
649
650 np.testing.assert_allclose(result.vertices, expected_vertices)
651 np.testing.assert_array_equal(result.codes, expected_codes)
652
653 # Usually closepoly is the last vertex but does not have to be.
654 codes += [Path.LINETO]
655 vertices += [(2, 1)]
656
657 path = Path(vertices, codes)
658 result = path.interpolated(2)
659
660 extra_expected_vertices = np.array([[3, 2],
661 [2, 1]])
662 expected_vertices = np.concatenate([expected_vertices, extra_expected_vertices])
663
664 expected_codes += [Path.LINETO] * 2
665
666 np.testing.assert_allclose(result.vertices, expected_vertices)
667 np.testing.assert_array_equal(result.codes, expected_codes)
668
669
670def test_interpolated_moveto_closepoly():

Callers

nothing calls this directly

Calls 2

interpolatedMethod · 0.95
PathClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…