diff options
author | Oscar Villellas <oscar.villellas@continuum.io> | 2017-01-03 20:30:59 +0100 |
---|---|---|
committer | Oscar Villellas <oscar.villellas@continuum.io> | 2017-01-03 20:30:59 +0100 |
commit | fde261788008fd830999a16dceb534a5168baa72 (patch) | |
tree | 90b883ae4f77845a45695c99385c869a66d088a3 /numpy/random | |
parent | 4c93e28685eecfd359f7ca9ad6f8003f054626ca (diff) | |
download | numpy-fde261788008fd830999a16dceb534a5168baa72.tar.gz |
fixed merged test
Diffstat (limited to 'numpy/random')
-rw-r--r-- | numpy/random/tests/test_random.py | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/numpy/random/tests/test_random.py b/numpy/random/tests/test_random.py index 64e6e2168..e8a7d0fbf 100644 --- a/numpy/random/tests/test_random.py +++ b/numpy/random/tests/test_random.py @@ -4,8 +4,8 @@ import warnings import numpy as np from numpy.testing import ( TestCase, run_module_suite, assert_, assert_raises, assert_equal, - assert_warns, assert_array_equal, assert_array_almost_equal, - suppress_warnings) + assert_warns, assert_no_warnings, assert_array_equal, + assert_array_almost_equal, suppress_warnings) from numpy import random from numpy.compat import asbytes import sys @@ -628,28 +628,22 @@ class TestRandomDist(TestCase): [[0.689515026297799, 9.880729819607714], [-0.023054015651998, 9.201096623542879]]]) - np.testing.assert_array_almost_equal(actual, desired, decimal=15) + assert_array_almost_equal(actual, desired, decimal=15) # Check for default size, was raising deprecation warning actual = np.random.multivariate_normal(mean, cov) desired = np.array([0.895289569463708, 9.17180864067987]) - np.testing.assert_array_almost_equal(actual, desired, decimal=15) + assert_array_almost_equal(actual, desired, decimal=15) # Check that non positive-semidefinite covariance warns with # RuntimeWarning mean = [0, 0] - cov = [[1, 2], [3, 4]] - with warnings.catch_warnings(record=True) as w: - warnings.simplefilter('always') - np.random.multivariate_normal(mean, cov) - assert len(w) == 1 - assert issubclass(w[0].category, RuntimeWarning) + cov = [[1, 2], [2, 1]] + assert_warns(RuntimeWarning, np.random.multivariate_normal, mean, cov) # and that it doesn't warn with RuntimeWarning check_valid='ignore' - with warnings.catch_warnings(record=True) as w: - warnings.simplefilter('always') - np.random.multivariate_normal(mean, cov, check_valid='ignore') - assert len(w) == 0 + assert_no_warnings(np.random.multivariate_normal, mean, cov, + check_valid='ignore') # and that it raises with RuntimeWarning check_valid='raises' assert_raises(ValueError, np.random.multivariate_normal, mean, cov, |