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

Method test_ptp

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

Source from the content-addressed store, hash-verified

3926 assert_(result is output)
3927
3928 def test_ptp(self):
3929 # Tests ptp on MaskedArrays.
3930 (x, X, XX, m, mx, mX, mXX, m2x, m2X, m2XX) = self.d
3931 (n, m) = X.shape
3932 assert_equal(mx.ptp(), mx.compressed().ptp())
3933 rows = np.zeros(n, float)
3934 cols = np.zeros(m, float)
3935 for k in range(m):
3936 cols[k] = mX[:, k].compressed().ptp()
3937 for k in range(n):
3938 rows[k] = mX[k].compressed().ptp()
3939 assert_equal(mX.ptp(0), cols)
3940 assert_equal(mX.ptp(1), rows)
3941
3942 def test_add_object(self):
3943 x = masked_array(['a', 'b'], mask=[1, 0], dtype=object)

Callers

nothing calls this directly

Calls 3

assert_equalFunction · 0.90
ptpMethod · 0.45
compressedMethod · 0.45

Tested by

no test coverage detected