|
9 | 9 |
|
10 | 10 | from . import util
|
11 | 11 |
|
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 |
| - |
20 | 12 | # Register the optionflag to skip whole blocks, i.e.
|
21 | 13 | # sequences of Examples without an intervening text.
|
22 | 14 | SKIPBLOCK = doctest.register_optionflag('SKIPBLOCK')
|
@@ -332,13 +324,8 @@ def check_output(self, want, got, optionflags):
|
332 | 324 | # OK then, convert strings to objects
|
333 | 325 | ns = dict(self.config.check_namespace)
|
334 | 326 | try:
|
335 |
| - with warnings.catch_warnings(): |
336 |
| - # NumPy's ragged array deprecation of np.array([1, (2, 3)]); |
337 |
| - # also array abbreviations: try `np.diag(np.arange(1000))` |
338 |
| - warnings.simplefilter('ignore', VisibleDeprecationWarning) |
339 |
| - |
340 |
| - a_want = eval(want, dict(ns)) |
341 |
| - a_got = eval(got, dict(ns)) |
| 327 | + a_want = eval(want, dict(ns)) |
| 328 | + a_got = eval(got, dict(ns)) |
342 | 329 | except Exception:
|
343 | 330 | # Maybe we're printing a numpy array? This produces invalid python
|
344 | 331 | # code: `print(np.arange(3))` produces "[0 1 2]" w/o commas between
|
@@ -433,12 +420,8 @@ def _do_check(self, want, got, strict_check):
|
433 | 420 | except Exception:
|
434 | 421 | pass
|
435 | 422 |
|
436 |
| - with warnings.catch_warnings(): |
437 |
| - # NumPy's ragged array deprecation of np.array([1, (2, 3)]) |
438 |
| - warnings.simplefilter('ignore', VisibleDeprecationWarning) |
439 |
| - |
440 |
| - # This line is the crux of the whole thing. The rest is mostly scaffolding. |
441 |
| - result = np.allclose(want, got, atol=self.atol, rtol=self.rtol, equal_nan=True) |
| 423 | + # This line is the crux of the whole thing. The rest is mostly scaffolding. |
| 424 | + result = np.allclose(want, got, atol=self.atol, rtol=self.rtol, equal_nan=True) |
442 | 425 | return result
|
443 | 426 |
|
444 | 427 |
|
|
0 commit comments