diff options
author | Roman Yurchak <rth.yurchak@pm.me> | 2018-09-13 04:49:37 +0200 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2018-09-12 19:49:37 -0700 |
commit | 88cbd3d857db84cf820a6210fde14814f1d1d92b (patch) | |
tree | 1e759353a844b9bd0d0c26bbd2834ff0cd61fbb8 /numpy/lib/tests/test_format.py | |
parent | fe6beb288befa5506b5c41ed498054e24b5241b5 (diff) | |
download | numpy-88cbd3d857db84cf820a6210fde14814f1d1d92b.tar.gz |
TST: Replace calls to unittest.TestCase.fail (#11933)
After the pytest migration, test classes no longer inherit
from unittest.TestCase and and the fail method does not
exist anymore.
In all these cases, we can use assert_raises and assert_raises_regex instead
Diffstat (limited to 'numpy/lib/tests/test_format.py')
-rw-r--r-- | numpy/lib/tests/test_format.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/numpy/lib/tests/test_format.py b/numpy/lib/tests/test_format.py index c7869c582..af64dd043 100644 --- a/numpy/lib/tests/test_format.py +++ b/numpy/lib/tests/test_format.py @@ -286,7 +286,8 @@ from io import BytesIO import numpy as np from numpy.testing import ( - assert_, assert_array_equal, assert_raises, raises, SkipTest + assert_, assert_array_equal, assert_raises, assert_raises_regex, + raises, SkipTest ) from numpy.lib import format @@ -678,12 +679,9 @@ def test_write_version(): (255, 255), ] for version in bad_versions: - try: + with assert_raises_regex(ValueError, + 'we only support format version.*'): format.write_array(f, arr, version=version) - except ValueError: - pass - else: - raise AssertionError("we should have raised a ValueError for the bad version %r" % (version,)) bad_version_magic = [ |