MCPcopy Index your code
hub / github.com/numpy/numpy / test_covhelper

Method test_covhelper

numpy/ma/tests/test_extras.py:1320–1338  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1318 return array(np.random.rand(12))
1319
1320 def test_covhelper(self):
1321 x = self._create_data()
1322 # Test not mask output type is a float.
1323 assert_(_covhelper(x, rowvar=True)[1].dtype, np.float32)
1324 assert_(_covhelper(x, y=x, rowvar=False)[1].dtype, np.float32)
1325 # Test not mask output is equal after casting to float.
1326 mask = x > 0.5
1327 assert_array_equal(
1328 _covhelper(
1329 np.ma.masked_array(x, mask), rowvar=True
1330 )[1].astype(bool),
1331 ~mask.reshape(1, -1),
1332 )
1333 assert_array_equal(
1334 _covhelper(
1335 np.ma.masked_array(x, mask), y=x, rowvar=False
1336 )[1].astype(bool),
1337 np.vstack((~mask, ~mask)),
1338 )
1339
1340 def test_1d_without_missing(self):
1341 # Test cov on 1D variable w/o missing values

Callers

nothing calls this directly

Calls 6

_create_dataMethod · 0.95
_covhelperFunction · 0.90
assert_array_equalFunction · 0.90
assert_Function · 0.85
astypeMethod · 0.80
reshapeMethod · 0.80

Tested by

no test coverage detected