MCPcopy Create free account
hub / github.com/numpy/numpy / test_minmax_func

Method test_minmax_func

numpy/ma/tests/test_core.py:1211–1234  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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))

Callers

nothing calls this directly

Calls 12

ravelFunction · 0.90
assert_equalFunction · 0.90
maxFunction · 0.90
minFunction · 0.90
whereFunction · 0.90
lessFunction · 0.90
greaterFunction · 0.90
arangeFunction · 0.85
reshapeMethod · 0.80
assert_Function · 0.50
ravelMethod · 0.45
reduceMethod · 0.45

Tested by

no test coverage detected