コード例 #1
0
 def test_line_to(self):
     p = path.Path()
     p.line_to((4, 5, 6))
     p.line_to((7, 8, 6))
     mpath = path.to_matplotlib_path([p])
     assert tuple(mpath.codes) == (MC.MOVETO, MC.LINETO, MC.LINETO)
     assert Vec2.list(mpath.vertices) == [(0, 0), (4, 5), (7, 8)]
コード例 #2
0
 def test_curve4_to(self):
     p = path.Path()
     p.curve4_to((4, 0, 2), (1, 1, 7), (3, 1, 5))
     mpath = path.to_matplotlib_path([p])
     assert tuple(mpath.codes) == (
         MC.MOVETO, MC.CURVE4, MC.CURVE4, MC.CURVE4
     )
     assert Vec2.list(mpath.vertices) == [(0, 0), (1, 1), (3, 1), (4, 0)]
コード例 #3
0
 def test_two_paths(self):
     p1 = path.Path()
     p1.line_to((4, 5, 6))
     p2 = path.Path()
     p2.line_to((7, 8, 6))
     mpath = path.to_matplotlib_path([p1, p2])
     assert tuple(mpath.codes) == (
         MC.MOVETO, MC.LINETO,
         MC.MOVETO, MC.LINETO,
     )
     assert Vec2.list(mpath.vertices) == [
         (0, 0), (4, 5),
         (0, 0), (7, 8),
     ]
コード例 #4
0
 def test_no_paths(self):
     with pytest.raises(ValueError):
         path.to_matplotlib_path([])