Skip to content

Commit

Permalink
MAINT: Ignore DeprecationWarning for random_integers in tests.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
charris committed Apr 10, 2016
1 parent 9a86dcb commit a2c4c11
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions numpy/random/tests/test_random.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,22 +260,26 @@ def test_randint(self):

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
# maximum allowed Python int that can be converted
# 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():
Expand Down

0 comments on commit a2c4c11

Please sign in to comment.