diff options
| author | Sebastian Berg <sebastian@sipsolutions.net> | 2014-02-12 11:57:27 +0100 |
|---|---|---|
| committer | Sebastian Berg <sebastian@sipsolutions.net> | 2014-02-16 00:00:22 +0100 |
| commit | ab04e1ae0e8eca717bc7e42f3b0a60c9ff764289 (patch) | |
| tree | 49ea02f820c4ee3eb484578abd0078f543ef4898 /numpy/testing/tests | |
| parent | 58e9e27c0c110f9be1558a53fb547dc1abc76fa4 (diff) | |
| download | numpy-ab04e1ae0e8eca717bc7e42f3b0a60c9ff764289.tar.gz | |
BUG: Force allclose logic to use inexact type
Casting y to an inexact type fixes problems such as
abs(MIN_INT) < 0, and generally makes sense since the allclose
logic is inherently for float types.
Diffstat (limited to 'numpy/testing/tests')
| -rw-r--r-- | numpy/testing/tests/test_utils.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/numpy/testing/tests/test_utils.py b/numpy/testing/tests/test_utils.py index 94fc4d655..5956a4294 100644 --- a/numpy/testing/tests/test_utils.py +++ b/numpy/testing/tests/test_utils.py @@ -53,6 +53,9 @@ class _GenericTest(object): a = np.array([1, 1], dtype=np.object) self._test_equal(a, 1) + def test_array_likes(self): + self._test_equal([1, 2, 3], (1, 2, 3)) + class TestArrayEqual(_GenericTest, unittest.TestCase): def setUp(self): self._assert_func = assert_array_equal @@ -373,6 +376,11 @@ class TestAssertAllclose(unittest.TestCase): assert_allclose(6, 10, rtol=0.5) self.assertRaises(AssertionError, assert_allclose, 10, 6, rtol=0.5) + def test_min_int(self): + a = np.array([np.iinfo(np.int_).min], dtype=np.int_) + # Should not raise: + assert_allclose(a, a) + class TestArrayAlmostEqualNulp(unittest.TestCase): @dec.knownfailureif(True, "Github issue #347") |
