diff options
author | Brigitta Sipocz <bsipocz@gmail.com> | 2020-07-12 13:50:02 -0700 |
---|---|---|
committer | Brigitta Sipőcz <bsipocz@gmail.com> | 2022-05-17 20:11:34 -0700 |
commit | 497dc9402d04754b512e344c8039caafd55351da (patch) | |
tree | 67d6b59afac53f31dda3f7dfe937a197a220ed00 /numpy/testing | |
parent | 59aad3cf436691d447e43038e3402500f13cd817 (diff) | |
download | numpy-497dc9402d04754b512e344c8039caafd55351da.tar.gz |
Remove python <3.6 related things
Diffstat (limited to 'numpy/testing')
-rw-r--r-- | numpy/testing/_private/utils.py | 3 | ||||
-rw-r--r-- | numpy/testing/tests/test_utils.py | 16 |
2 files changed, 5 insertions, 14 deletions
diff --git a/numpy/testing/_private/utils.py b/numpy/testing/_private/utils.py index 80a6fdd10..4a8f42e06 100644 --- a/numpy/testing/_private/utils.py +++ b/numpy/testing/_private/utils.py @@ -1342,9 +1342,6 @@ def assert_raises_regex(exception_class, expected_regexp, *args, **kwargs): Alternatively, can be used as a context manager like `assert_raises`. - Name of this function adheres to Python 3.2+ reference, but should work in - all versions down to 2.6. - Notes ----- .. versionadded:: 1.9.0 diff --git a/numpy/testing/tests/test_utils.py b/numpy/testing/tests/test_utils.py index 919ca751f..1aaa8f559 100644 --- a/numpy/testing/tests/test_utils.py +++ b/numpy/testing/tests/test_utils.py @@ -212,7 +212,7 @@ class TestArrayEqual(_GenericTest): with pytest.raises(AssertionError): with np.errstate(all="raise"): np.testing.assert_array_equal( - np.array([1, 2, 3], np.float32), + np.array([1, 2, 3], np.float32), np.array([1, 1e-40, 3], np.float32)) @@ -1224,7 +1224,7 @@ class TestStringEqual: lambda: assert_string_equal("aaa", "a+b")) -def assert_warn_len_equal(mod, n_in_context, py34=None, py37=None): +def assert_warn_len_equal(mod, n_in_context, py37=None): try: mod_warns = mod.__warningregistry__ except AttributeError: @@ -1238,10 +1238,7 @@ def assert_warn_len_equal(mod, n_in_context, py34=None, py37=None): mod_warns = {} num_warns = len(mod_warns) - # Python 3.4 appears to clear any pre-existing warnings of the same type, - # when raising warnings inside a catch_warnings block. So, there is a - # warning generated by the tests within the context manager, but no - # previous warnings. + if 'version' in mod_warns: # Python 3 adds a 'version' entry to the registry, # do not count it. @@ -1253,9 +1250,7 @@ def assert_warn_len_equal(mod, n_in_context, py34=None, py37=None): if sys.version_info[:2] >= (3, 7): if py37 is not None: n_in_context = py37 - else: - if py34 is not None: - n_in_context = py34 + assert_equal(num_warns, n_in_context) def test_warn_len_equal_call_scenarios(): @@ -1318,12 +1313,11 @@ def test_clear_and_catch_warnings(): warnings.warn('Another warning') assert_warn_len_equal(my_mod, 1, py37=0) # Another warning, no module spec does add to warnings dict, except on - # Python 3.4 (see comments in `assert_warn_len_equal`) # Python 3.7 catch_warnings doesn't make an entry for 'ignore'. with clear_and_catch_warnings(): warnings.simplefilter('ignore') warnings.warn('Another warning') - assert_warn_len_equal(my_mod, 2, py34=1, py37=0) + assert_warn_len_equal(my_mod, 2, py37=0) def test_suppress_warnings_module(): |