-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
allow setting collection offsets to empty #22408
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1101,3 +1101,13 @@ def test_set_offset_units(): | |
off0 = sc.get_offsets() | ||
sc.set_offsets(list(zip(y, d))) | ||
np.testing.assert_allclose(off0, sc.get_offsets()) | ||
|
||
|
||
def test_set_offset_empty(): | ||
expected = mcollections.Collection(offsets=np.column_stack([[], []])) | ||
|
||
modified = mcollections.Collection( | ||
offsets=np.column_stack([[0, 1], [0, 1]]) | ||
) | ||
modified.set_offsets([[], []]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that this should actually be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please check what other |
||
np.testing.assert_allclose(expected.get_offsets(), modified.get_offsets()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which will require some changes to the tests.
The docs say(N, 2) so this should be the degenerate case of ((N, 2), .., (2, 2), (1, 2), (0, 2)) (the (2,) case is a special case for spelling (1, 2)).