(self)
| 1209 | assert_equal(2, count((1,2))) |
| 1210 | |
| 1211 | def test_minmax_func(self): |
| 1212 | # Tests minimum and maximum. |
| 1213 | (x, y, a10, m1, m2, xm, ym, z, zm, xf) = self.d |
| 1214 | # max doesn't work if shaped |
| 1215 | xr = np.ravel(x) |
| 1216 | xmr = ravel(xm) |
| 1217 | # following are true because of careful selection of data |
| 1218 | assert_equal(max(xr), maximum.reduce(xmr)) |
| 1219 | assert_equal(min(xr), minimum.reduce(xmr)) |
| 1220 | |
| 1221 | assert_equal(minimum([1, 2, 3], [4, 0, 9]), [1, 0, 3]) |
| 1222 | assert_equal(maximum([1, 2, 3], [4, 0, 9]), [4, 2, 9]) |
| 1223 | x = arange(5) |
| 1224 | y = arange(5) - 2 |
| 1225 | x[3] = masked |
| 1226 | y[0] = masked |
| 1227 | assert_equal(minimum(x, y), where(less(x, y), x, y)) |
| 1228 | assert_equal(maximum(x, y), where(greater(x, y), x, y)) |
| 1229 | assert_(minimum.reduce(x) == 0) |
| 1230 | assert_(maximum.reduce(x) == 4) |
| 1231 | |
| 1232 | x = arange(4).reshape(2, 2) |
| 1233 | x[-1, -1] = masked |
| 1234 | assert_equal(maximum.reduce(x, axis=None), 2) |
| 1235 | |
| 1236 | def test_minimummaximum_func(self): |
| 1237 | a = np.ones((2, 2)) |
nothing calls this directly
no test coverage detected