@@ -546,27 +546,13 @@ def test_cleanup_closepoly():
546
546
def test_simplify_closepoly ():
547
547
# The values of the vertices in a CLOSEPOLY should always be ignored,
548
548
# in favor of the most recent MOVETO's vertex values
549
- paths = [
550
- Path ([(0 , 0 ), (1 , 0 ), (1 , 1 ), (0 , 0 )],
551
- [Path .MOVETO , Path .LINETO , Path .LINETO , Path .CLOSEPOLY ]),
552
- Path ([(0 , 0 ), (1 , 0 ), (1 , 1 ), (np .nan , np .nan )],
553
- [Path .MOVETO , Path .LINETO , Path .LINETO , Path .CLOSEPOLY ]),
554
- Path ([(0 , 0 ), (1 , 0 ), (1 , 1 ), (40 , 50 )],
555
- [Path .MOVETO , Path .LINETO , Path .LINETO , Path .CLOSEPOLY ]),
556
- Path ([(0 , 0 ), (0.5 , 0 ), (1 , 0 ), (1 , 0.5 ),
557
- (1 , 1 ), (0.5 , 0.5 ), (0 , 0 )],
558
- [Path .MOVETO , Path .LINETO , Path .LINETO , Path .LINETO ,
559
- Path .LINETO , Path .LINETO , Path .CLOSEPOLY ]),
560
- ]
549
+ path_ref = Path ([(0 , 0 ), (1 , 0 ), (1 , 1 ), (40 , 50 )],
550
+ [Path .MOVETO , Path .LINETO , Path .LINETO , Path .CLOSEPOLY ])
551
+ path_test = Path ([(0 , 0 ), (1 , 0 ), (1 , 1 ), (np .nan , np .nan )],
552
+ [Path .MOVETO , Path .LINETO , Path .LINETO , Path .CLOSEPOLY ])
553
+
554
+ path_ref_simplified = path_ref .cleaned (simplify = True )
555
+ path_test_simplified = path_test .cleaned (simplify = True )
561
556
562
- first_segments = list (paths [0 ].cleaned (simplify = True ).iter_segments ())
563
- for path in paths [1 :]:
564
- simplified_segments = list (path .cleaned (simplify = True ).iter_segments ())
565
- for seg1 , seg2 in zip (simplified_segments , first_segments ):
566
- vertex1 , code1 = seg1
567
- vertex2 , code2 = seg2
568
-
569
- # Check whether the vertices are equal
570
- assert_array_equal (vertex1 , vertex2 )
571
- # Check whether the codes are equal
572
- assert code1 == code2
557
+ assert_array_equal (path_ref_simplified .vertices , path_test_simplified .vertices )
558
+ assert_array_equal (path_ref_simplified .codes , path_test_simplified .codes )
0 commit comments