-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
BUG: Period.__eq__ numpy scalar (#44182 (comment)) #44285
Changes from 4 commits
2ab0228
024dc78
1bc17ed
32e1883
6c05457
6592e97
784d2e8
f8e89f1
9a2db3b
e0fa706
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 |
---|---|---|
|
@@ -1148,6 +1148,16 @@ def test_period_cmp_nat(self): | |
assert not left <= right | ||
assert not left >= right | ||
|
||
@pytest.mark.parametrize( | ||
"scalar, expected", ((np.array(0), np.bool_(False)), (np.int_(0), False)) | ||
) | ||
def test_comparison_numpy_scalar(self, scalar, expected): | ||
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. scalars are already tested; its zerodim we need to catch. in particular a zero-dim ndarray containing a Period object |
||
p = Period("2000-01", "M") | ||
|
||
for left, right in ((p, scalar), (scalar, p)): | ||
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. the loop here is unnecessary; its two lines either way and clearer without |
||
assert not left == right | ||
assert (left == right) is expected | ||
|
||
|
||
class TestArithmetic: | ||
def test_sub_delta(self): | ||
|
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.
np.ndim(..) > 0