Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NaN-proof rectangle_perimeter #7115

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions skimage/draw/tests/test_draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -1150,3 +1150,18 @@ def test_rectangle_perimiter_clip_bottom_left():
clip=False)
img[rr, cc] = 1
assert_array_equal(img, expected)


@pytest.mark.skipif(not has_mpl, reason="matplotlib not installed")
def test_rectangle_perimeter_nan():
# Prevent regression, see https://github.com/scikit-image/scikit-image/issues/7114
result = rectangle_perimeter((np.nan, np.nan), (np.nan, np.nan))
desired = (
np.array(
[-9223372036854775808, -9223372036854775808,
-9223372036854775808, -9223372036854775808]),
np.array(
[-9223372036854775808, -9223372036854775808,
-9223372036854775808, -9223372036854775808])
)
np.testing.assert_equal(result, desired)