MCPcopy
hub / github.com/numpy/numpy / test_minmax_func

Method test_minmax_func

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 12

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

Tested by

no test coverage detected