Skip to content

Commit 952227e

Browse files
authored
Merge pull request #23528 from meeseeksmachine/auto-backport-of-pr-23523-on-v3.5.x
Backport PR #23523 on branch v3.5.x (TST: Update Quantity test class)
2 parents 88e7680 + 632e4d7 commit 952227e

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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy