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

Appearance settings

Commit 23dbd33

Browse filesBrowse files
committed
Add test for Path.path_in_path
1 parent ddb3163 commit 23dbd33
Copy full SHA for 23dbd33

File tree

Expand file treeCollapse file tree

1 file changed

+16
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+16
-0
lines changed

‎lib/matplotlib/tests/test_path.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_path.py
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,22 @@ def test_point_in_path():
6060
np.testing.assert_equal(ret, [True, False])
6161

6262

63+
@pytest.mark.parametrize(
64+
"other_path, inside, reverted_inside",
65+
[(Path._create_closed([(0.25, 0.25), (0.25, 0.75), (0.75, 0.75), (0.75, 0.25)]),
66+
True, False),
67+
(Path._create_closed([(-0.25, -0.25), (-0.25, 1.75), (1.75, 1.75), (1.75, -0.25)]),
68+
False, True),
69+
(Path._create_closed([(0.25, 0.25), (0.25, 1.25), (1.25, 1.25), (1.25, 0.25)]),
70+
False, False),
71+
(Path._create_closed([(0, 0), (0, 1), (1, 1), (1, 0)]), False, False)]
72+
)
73+
def test_path_in_path(other_path, inside, reverted_inside):
74+
path = Path._create_closed([(0, 0), (0, 1), (1, 1), (1, 0)])
75+
assert path.contains_path(other_path) is inside
76+
assert other_path.contains_path(path) is reverted_inside
77+
78+
6379
def test_contains_points_negative_radius():
6480
path = Path.unit_circle()
6581

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.