diff options
author | Nathaniel J. Smith <njs@pobox.com> | 2015-12-12 08:01:03 +0000 |
---|---|---|
committer | Nathaniel J. Smith <njs@pobox.com> | 2015-12-12 08:01:03 +0000 |
commit | 623fdd95cf1505fb867cab0040d68714422ac1bf (patch) | |
tree | b2140320d5345f4418d3e395ee8a9cfd1fb3cebe | |
parent | 90a1a9fe056d84a8ddc51a50076247d658b9b669 (diff) | |
parent | 7747c3a88cb0cad5687093d1345efcb2743fc1d5 (diff) | |
download | numpy-623fdd95cf1505fb867cab0040d68714422ac1bf.tar.gz |
Merge pull request #6791 from Daetalus/bug_fixing
BUG: Fix thinko in assert_deprecated()
-rw-r--r-- | numpy/core/tests/test_deprecations.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/numpy/core/tests/test_deprecations.py b/numpy/core/tests/test_deprecations.py index 518b367f0..372af9c0b 100644 --- a/numpy/core/tests/test_deprecations.py +++ b/numpy/core/tests/test_deprecations.py @@ -89,7 +89,7 @@ class _DeprecationTestCase(object): if num is not None and num_found != num: msg = "%i warnings found but %i expected." % (len(self.log), num) lst = [w.category for w in self.log] - raise AssertionError("\n".join([msg] + [lst])) + raise AssertionError("\n".join([msg] + lst)) with warnings.catch_warnings(): warnings.filterwarnings("error", message=self.message, @@ -400,5 +400,18 @@ class TestNonCContiguousViewDeprecation(_DeprecationTestCase): self.assert_deprecated(np.ones((2,2)).T.view, args=(np.int8,)) +class TestTestDeprecated(object): + def test_assert_deprecated(self): + test_case_instance = _DeprecationTestCase() + test_case_instance.setUp() + assert_raises(AssertionError, + test_case_instance.assert_deprecated, + lambda: None) + + def foo(): + warnings.warn("foo", category=DeprecationWarning) + + test_case_instance.assert_deprecated(foo) + if __name__ == "__main__": run_module_suite() |