@@ -386,3 +386,27 @@ def test_datetime_datetime_fails():
386
386
387
387
with pytest .raises (TypeError ):
388
388
mpatches .Rectangle ((0 , start ), 1 , dt_delta )
389
+
390
+
391
+ def test_contains_point ():
392
+ ell = mpatches .Ellipse ((0.5 , 0.5 ), 0.5 , 1.0 , 0 )
393
+ points = [(0.0 , 0.5 ), (0.2 , 0.5 ), (0.25 , 0.5 ), (0.5 , 0.5 )]
394
+ path = ell .get_path ()
395
+ transform = ell .get_transform ()
396
+ radius = ell ._process_radius (None )
397
+ expected = np .array ([path .contains_point (point ,
398
+ transform ,
399
+ radius ) for point in points ])
400
+ result = np .array ([ell .contains_point (point ) for point in points ])
401
+ assert np .all (result == expected )
402
+
403
+
404
+ def test_contains_points ():
405
+ ell = mpatches .Ellipse ((0.5 , 0.5 ), 0.5 , 1.0 , 0 )
406
+ points = [(0.0 , 0.5 ), (0.2 , 0.5 ), (0.25 , 0.5 ), (0.5 , 0.5 )]
407
+ path = ell .get_path ()
408
+ transform = ell .get_transform ()
409
+ radius = ell ._process_radius (None )
410
+ expected = path .contains_points (points , transform , radius )
411
+ result = ell .contains_points (points )
412
+ assert np .all (result == expected )
0 commit comments