| 3344 | assert_equal(m.transpose(), m._data.transpose()) |
| 3345 | |
| 3346 | def test_allclose(self): |
| 3347 | # Tests allclose on arrays |
| 3348 | a = np.random.rand(10) |
| 3349 | b = a + np.random.rand(10) * 1e-8 |
| 3350 | assert_(allclose(a, b)) |
| 3351 | # Test allclose w/ infs |
| 3352 | a[0] = np.inf |
| 3353 | assert_(not allclose(a, b)) |
| 3354 | b[0] = np.inf |
| 3355 | assert_(allclose(a, b)) |
| 3356 | # Test allclose w/ masked |
| 3357 | a = masked_array(a) |
| 3358 | a[-1] = masked |
| 3359 | assert_(allclose(a, b, masked_equal=True)) |
| 3360 | assert_(not allclose(a, b, masked_equal=False)) |
| 3361 | # Test comparison w/ scalar |
| 3362 | a *= 1e-8 |
| 3363 | a[0] = 0 |
| 3364 | assert_(allclose(a, 0, masked_equal=True)) |
| 3365 | |
| 3366 | # Test that the function works for MIN_INT integer typed arrays |
| 3367 | a = masked_array([np.iinfo(np.int_).min], dtype=np.int_) |
| 3368 | assert_(allclose(a, a)) |
| 3369 | |
| 3370 | def test_allclose_timedelta(self): |
| 3371 | # Allclose currently works for timedelta64 as long as `atol` is |