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

Function test_Polygon_close

lib/matplotlib/tests/test_patches.py:21–55  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

19
20
21def test_Polygon_close():
22 #: GitHub issue #1018 identified a bug in the Polygon handling
23 #: of the closed attribute; the path was not getting closed
24 #: when set_xy was used to set the vertices.
25
26 # open set of vertices:
27 xy = [[0, 0], [0, 1], [1, 1]]
28 # closed set:
29 xyclosed = xy + [[0, 0]]
30
31 # start with open path and close it:
32 p = Polygon(xy, closed=True)
33 assert p.get_closed()
34 assert_array_equal(p.get_xy(), xyclosed)
35 p.set_xy(xy)
36 assert_array_equal(p.get_xy(), xyclosed)
37
38 # start with closed path and open it:
39 p = Polygon(xyclosed, closed=False)
40 assert_array_equal(p.get_xy(), xy)
41 p.set_xy(xyclosed)
42 assert_array_equal(p.get_xy(), xy)
43
44 # start with open path and leave it open:
45 p = Polygon(xy, closed=False)
46 assert not p.get_closed()
47 assert_array_equal(p.get_xy(), xy)
48 p.set_xy(xy)
49 assert_array_equal(p.get_xy(), xy)
50
51 # start with closed path and leave it closed:
52 p = Polygon(xyclosed, closed=True)
53 assert_array_equal(p.get_xy(), xyclosed)
54 p.set_xy(xyclosed)
55 assert_array_equal(p.get_xy(), xyclosed)
56
57
58def test_corner_center():

Callers

nothing calls this directly

Calls 4

get_closedMethod · 0.95
get_xyMethod · 0.95
set_xyMethod · 0.95
PolygonClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…