@@ -60,6 +60,25 @@ def test_point_in_path():
60
60
np .testing .assert_equal (ret , [True , False ])
61
61
62
62
63
+ @pytest .mark .parametrize (
64
+ "other_path, inside, inverted_inside" ,
65
+ [(Path ([(0.25 , 0.25 ), (0.25 , 0.75 ), (0.75 , 0.75 ), (0.75 , 0.25 ), (0.25 , 0.25 )],
66
+ closed = True ), True , False ),
67
+ (Path ([(- 0.25 , - 0.25 ), (- 0.25 , 1.75 ), (1.75 , 1.75 ), (1.75 , - 0.25 ), (- 0.25 , - 0.25 )],
68
+ closed = True ), False , True ),
69
+ (Path ([(- 0.25 , - 0.25 ), (- 0.25 , 1.75 ), (0.5 , 0.5 ),
70
+ (1.75 , 1.75 ), (1.75 , - 0.25 ), (- 0.25 , - 0.25 )],
71
+ closed = True ), False , False ),
72
+ (Path ([(0.25 , 0.25 ), (0.25 , 1.25 ), (1.25 , 1.25 ), (1.25 , 0.25 ), (0.25 , 0.25 )],
73
+ closed = True ), False , False ),
74
+ (Path ([(0 , 0 ), (0 , 1 ), (1 , 1 ), (1 , 0 ), (0 , 0 )], closed = True ), False , False ),
75
+ (Path ([(2 , 2 ), (2 , 3 ), (3 , 3 ), (3 , 2 ), (2 , 2 )], closed = True ), False , False )])
76
+ def test_contains_path (other_path , inside , inverted_inside ):
77
+ path = Path ([(0 , 0 ), (0 , 1 ), (1 , 1 ), (1 , 0 ), (0 , 0 )], closed = True )
78
+ assert path .contains_path (other_path ) is inside
79
+ assert other_path .contains_path (path ) is inverted_inside
80
+
81
+
63
82
def test_contains_points_negative_radius ():
64
83
path = Path .unit_circle ()
65
84
0 commit comments