diff options
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/tests/test_deprecations.py | 15 | ||||
-rw-r--r-- | numpy/ma/tests/test_core.py | 8 |
2 files changed, 18 insertions, 5 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() diff --git a/numpy/ma/tests/test_core.py b/numpy/ma/tests/test_core.py index 53cdef978..e0d9f072c 100644 --- a/numpy/ma/tests/test_core.py +++ b/numpy/ma/tests/test_core.py @@ -764,25 +764,25 @@ class TestMaskedArray(TestCase): t_2d = masked_array(data = [([[1, 2], [3,4]],)], mask = [([[False, True], [True, False]],)], - dtype = [('a', '<i8', (2,2))]) + dtype = [('a', '<i4', (2,2))]) assert_(str(t_2d[0]) == "([[1, --], [--, 4]],)") assert_(repr(t_2d[0]) == "([[1, --], [--, 4]],)") t_0d = masked_array(data = [(1,2)], mask = [(True,False)], - dtype = [('a', '<i8'), ('b', '<i8')]) + dtype = [('a', '<i4'), ('b', '<i4')]) assert_(str(t_0d[0]) == "(--, 2)") assert_(repr(t_0d[0]) == "(--, 2)") t_2d = masked_array(data = [([[1, 2], [3,4]], 1)], mask = [([[False, True], [True, False]], False)], - dtype = [('a', '<i8', (2,2)), ('b', float)]) + dtype = [('a', '<i4', (2,2)), ('b', float)]) assert_(str(t_2d[0]) == "([[1, --], [--, 4]], 1.0)") assert_(repr(t_2d[0]) == "([[1, --], [--, 4]], 1.0)") t_ne = masked_array(data=[(1, (1, 1))], mask=[(True, (True, False))], - dtype = [('a', '<i8'), ('b', 'i4,i4')]) + dtype = [('a', '<i4'), ('b', 'i4,i4')]) assert_(str(t_ne[0]) == "(--, (--, 1))") assert_(repr(t_ne[0]) == "(--, (--, 1))") |