Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite631edb

Browse files
authored
Merge pull request#25730 from oscargus/testpathinpath
Add test for Path.contains_path
2 parents70e674e +5233b32 commite631edb

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

‎lib/matplotlib/tests/test_path.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,25 @@ def test_point_in_path():
6060
np.testing.assert_equal(ret, [True,False])
6161

6262

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+
deftest_contains_path(other_path,inside,inverted_inside):
77+
path=Path([(0,0), (0,1), (1,1), (1,0), (0,0)],closed=True)
78+
assertpath.contains_path(other_path)isinside
79+
assertother_path.contains_path(path)isinverted_inside
80+
81+
6382
deftest_contains_points_negative_radius():
6483
path=Path.unit_circle()
6584

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp