From a2c4c117478b34a0761a98a9e5c474ab5c4f5490 Mon Sep 17 00:00:00 2001 From: Charles Harris Date: Sun, 10 Apr 2016 10:43:58 -0600 Subject: MAINT: Ignore DeprecationWarning for random_integers in tests. The warning turned up when the numpy/randome/tests were run using $ python runtests.py -t numpy/random/tests/ It doesn't show when all the tests are run. --- numpy/random/tests/test_random.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'numpy/random') diff --git a/numpy/random/tests/test_random.py b/numpy/random/tests/test_random.py index a07fa52f5..013205835 100644 --- a/numpy/random/tests/test_random.py +++ b/numpy/random/tests/test_random.py @@ -260,11 +260,13 @@ class TestRandomDist(TestCase): def test_random_integers(self): np.random.seed(self.seed) - actual = np.random.random_integers(-99, 99, size=(3, 2)) - desired = np.array([[31, 3], - [-52, 41], - [-48, -66]]) - assert_array_equal(actual, desired) + with warnings.catch_warnings(): + warnings.simplefilter("ignore", DeprecationWarning) + actual = np.random.random_integers(-99, 99, size=(3, 2)) + desired = np.array([[31, 3], + [-52, 41], + [-48, -66]]) + assert_array_equal(actual, desired) def test_random_integers_max_int(self): # Tests whether random_integers can generate the @@ -272,10 +274,12 @@ class TestRandomDist(TestCase): # into a C long. Previous implementations of this # method have thrown an OverflowError when attempting # to generate this integer. - actual = np.random.random_integers(np.iinfo('l').max, - np.iinfo('l').max) - desired = np.iinfo('l').max - assert_equal(actual, desired) + with warnings.catch_warnings(): + warnings.simplefilter("ignore", DeprecationWarning) + actual = np.random.random_integers(np.iinfo('l').max, + np.iinfo('l').max) + desired = np.iinfo('l').max + assert_equal(actual, desired) def test_random_integers_deprecated(self): with warnings.catch_warnings(): -- cgit v1.2.1