| 591 | |
| 592 | |
| 593 | def test_cleanup_closepoly(): |
| 594 | # if the first connected component of a Path ends in a CLOSEPOLY, but that |
| 595 | # component contains a NaN, then Path.cleaned should ignore not just the |
| 596 | # control points but also the CLOSEPOLY, since it has nowhere valid to |
| 597 | # point. |
| 598 | paths = [ |
| 599 | Path([[np.nan, np.nan], [np.nan, np.nan]], |
| 600 | [Path.MOVETO, Path.CLOSEPOLY]), |
| 601 | # we trigger a different path in the C++ code if we don't pass any |
| 602 | # codes explicitly, so we must also make sure that this works |
| 603 | Path([[np.nan, np.nan], [np.nan, np.nan]]), |
| 604 | # we should also make sure that this cleanup works if there's some |
| 605 | # multi-vertex curves |
| 606 | Path([[np.nan, np.nan], [np.nan, np.nan], [np.nan, np.nan], |
| 607 | [np.nan, np.nan]], |
| 608 | [Path.MOVETO, Path.CURVE3, Path.CURVE3, Path.CLOSEPOLY]) |
| 609 | ] |
| 610 | for p in paths: |
| 611 | cleaned = p.cleaned(remove_nans=True) |
| 612 | assert len(cleaned) == 1 |
| 613 | assert cleaned.codes[0] == Path.STOP |
| 614 | |
| 615 | |
| 616 | def test_interpolated_moveto(): |