(self)
| 1330 | assert_equal(2, count((1, 2))) |
| 1331 | |
| 1332 | def test_minmax_func(self): |
| 1333 | # Tests minimum and maximum. |
| 1334 | x, y, _, _, _, xm, _, _, _, _ = self._create_data() |
| 1335 | # max doesn't work if shaped |
| 1336 | xr = np.ravel(x) |
| 1337 | xmr = ravel(xm) |
| 1338 | # following are true because of careful selection of data |
| 1339 | assert_equal(max(xr), maximum.reduce(xmr)) |
| 1340 | assert_equal(min(xr), minimum.reduce(xmr)) |
| 1341 | |
| 1342 | assert_equal(minimum([1, 2, 3], [4, 0, 9]), [1, 0, 3]) |
| 1343 | assert_equal(maximum([1, 2, 3], [4, 0, 9]), [4, 2, 9]) |
| 1344 | x = arange(5) |
| 1345 | y = arange(5) - 2 |
| 1346 | x[3] = masked |
| 1347 | y[0] = masked |
| 1348 | assert_equal(minimum(x, y), where(less(x, y), x, y)) |
| 1349 | assert_equal(maximum(x, y), where(greater(x, y), x, y)) |
| 1350 | assert_(minimum.reduce(x) == 0) |
| 1351 | assert_(maximum.reduce(x) == 4) |
| 1352 | |
| 1353 | x = arange(4).reshape(2, 2) |
| 1354 | x[-1, -1] = masked |
| 1355 | assert_equal(maximum.reduce(x, axis=None), 2) |
| 1356 | |
| 1357 | def test_minimummaximum_func(self): |
| 1358 | a = np.ones((2, 2)) |
nothing calls this directly
no test coverage detected