8000 BENCH: Explicitly skip reversed (arg)partition case because they fail · numpy/numpy@cc17c38 · GitHub
[go: up one dir, main page]

Skip to content

Commit cc17c38

Browse files
committed
BENCH: Explicitly skip reversed (arg)partition case because they fail
This doesn't seem like an ideal solution, but is "minimal"?
1 parent d5f273b commit cc17c38

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

benchmarks/benchmarks/bench_function_base.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
import numpy as np
44

5+
try:
6+
# SkipNotImplemented is available since 6.0
7+
from asv_runner.benchmarks.mark import SkipNotImplemented
8+
except ImportError:
9+
SkipNotImplemented = NotImplementedError
10+
11+
512
class Linspace(Benchmark):
613
def setup(self):
714
self.d = np.array([1, 2, 3])
@@ -169,6 +176,13 @@ def reversed(size, dtype):
169176
"""
170177
Returns an array that's in descending order.
171178
"""
179+
dtype = np.dtype(dtype)
180+
try:
181+
with np.errstate(over="raise"):
182+
res = dtype.type(size-1)
183+
except (OverflowError, FloatingPointError):
184+
raise SkipNotImplemented("Cannot construct arange for this size.")
185+
172186
return np.arange(size-1, -1, -1, dtype=dtype)
173187

174188
@staticmethod

0 commit comments

Comments
 (0)
0