|
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')
|
@@ -331,13 +323,8 @@ def check_output(self, want, got, optionflags):
|
331 | 323 | # OK then, convert strings to objects
|
332 | 324 | ns = dict(self.config.check_namespace)
|
333 | 325 | 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)) |
341 | 328 | except Exception:
|
342 | 329 | # Maybe we're printing a numpy array? This produces invalid python
|
343 | 330 | # 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):
|
432 | 419 | except Exception:
|
433 | 420 | pass
|
434 | 421 |
|
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) |
441 | 424 | return result
|
442 | 425 |
|
443 | 426 |
|
|
0 commit comments