10000 Backport PR #23523: TST: Update Quantity test class · matplotlib/matplotlib@632e4d7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 632e4d7

Browse files
jklymakmeeseeksmachine
authored andcommitted
Backport PR #23523: TST: Update Quantity test class
1 parent 88e7680 commit 632e4d7

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lib/matplotlib/tests/test_image.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,7 +1170,7 @@ def __getitem__(self, item):
11701170
def __array_ufunc__(self, ufunc, method, *inputs, **kwargs):
11711171
func = getattr(ufunc, method)
11721172
if "out" in kwargs:
1173-
raise NotImplementedError
1173+
return NotImplemented
11741174
if len(inputs) == 1:
11751175
i0 = inputs[0]
11761176
unit = getattr(i0, "units", "dimensionless")
@@ -1190,11 +1190,16 @@ def __array_ufunc__(self, ufunc, method, *inputs, **kwargs):
11901190
unit = f"{u0}*{u1}"
11911191
elif ufunc == np.divide:
11921192
unit = f"{u0}/({u1})"
1193+
elif ufunc in (np.greater, np.greater_equal,
1194+
np.equal, np.not_equal,
1195+
np.less, np.less_equal):
1196+
# Comparisons produce unitless booleans for output
1197+
unit = None
11931198
else:
1194-
raise NotImplementedError
1199+
return NotImplemented
11951200
out_arr = func(i0.view(np.ndarray), i1.view(np.ndarray), **kwargs)
11961201
else:
1197-
raise NotImplementedError
1202+
return NotImplemented
11981203
if unit is None:
11991204
out_arr = np.array(out_arr)
12001205
else:

0 commit comments

Comments
 (0)
0