| 3130 | assert_equal(m.transpose(), m._data.transpose()) |
| 3131 | |
| 3132 | def test_allclose(self): |
| 3133 | # Tests allclose on arrays |
| 3134 | a = np.random.rand(10) |
| 3135 | b = a + np.random.rand(10) * 1e-8 |
| 3136 | assert_(allclose(a, b)) |
| 3137 | # Test allclose w/ infs |
| 3138 | a[0] = np.inf |
| 3139 | assert_(not allclose(a, b)) |
| 3140 | b[0] = np.inf |
| 3141 | assert_(allclose(a, b)) |
| 3142 | # Test allclose w/ masked |
| 3143 | a = masked_array(a) |
| 3144 | a[-1] = masked |
| 3145 | assert_(allclose(a, b, masked_equal=True)) |
| 3146 | assert_(not allclose(a, b, masked_equal=False)) |
| 3147 | # Test comparison w/ scalar |
| 3148 | a *= 1e-8 |
| 3149 | a[0] = 0 |
| 3150 | assert_(allclose(a, 0, masked_equal=True)) |
| 3151 | |
| 3152 | # Test that the function works for MIN_INT integer typed arrays |
| 3153 | a = masked_array([np.iinfo(np.int_).min], dtype=np.int_) |
| 3154 | assert_(allclose(a, a)) |
| 3155 | |
| 3156 | def test_allclose_timedelta(self): |
| 3157 | # Allclose currently works for timedelta64 as long as `atol` is |