Skip to content

Commit e2de015

Browse files
committed
MAINT: rm monkeying with VisibleDeprecationWarnings
1 parent f22abca commit e2de015

File tree

1 file changed

+4
-21
lines changed

1 file changed

+4
-21
lines changed

scipy_doctest/impl.py

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,6 @@
99

1010
from . import util
1111

12-
13-
## shim numpy 1.x vs 2.0
14-
if np.__version__ < "2":
15-
VisibleDeprecationWarning = np.VisibleDeprecationWarning
16-
else:
17-
VisibleDeprecationWarning = np.exceptions.VisibleDeprecationWarning
18-
19-
2012
# Register the optionflag to skip whole blocks, i.e.
2113
# sequences of Examples without an intervening text.
2214
SKIPBLOCK = doctest.register_optionflag('SKIPBLOCK')
@@ -331,13 +323,8 @@ def check_output(self, want, got, optionflags):
331323
# OK then, convert strings to objects
332324
ns = dict(self.config.check_namespace)
333325
try:
334-
with warnings.catch_warnings():
335-
# NumPy's ragged array deprecation of np.array([1, (2, 3)]);
336-
# also array abbreviations: try `np.diag(np.arange(1000))`
337-
warnings.simplefilter('ignore', VisibleDeprecationWarning)
338-
339-
a_want = eval(want, dict(ns))
340-
a_got = eval(got, dict(ns))
326+
a_want = eval(want, dict(ns))
327+
a_got = eval(got, dict(ns))
341328
except Exception:
342329
# Maybe we're printing a numpy array? This produces invalid python
343330
# code: `print(np.arange(3))` produces "[0 1 2]" w/o commas between
@@ -432,12 +419,8 @@ def _do_check(self, want, got, strict_check):
432419
except Exception:
433420
pass
434421

435-
with warnings.catch_warnings():
436-
# NumPy's ragged array deprecation of np.array([1, (2, 3)])
437-
warnings.simplefilter('ignore', VisibleDeprecationWarning)
438-
439-
# This line is the crux of the whole thing. The rest is mostly scaffolding.
440-
result = np.allclose(want, got, atol=self.atol, rtol=self.rtol, equal_nan=True)
422+
# This line is the crux of the whole thing. The rest is mostly scaffolding.
423+
result = np.allclose(want, got, atol=self.atol, rtol=self.rtol, equal_nan=True)
441424
return result
442425

443426

0 commit comments

Comments
 (0)