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

Method test_ddof

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

Source from the content-addressed store, hash-verified

1305 self.data2 = array(np.random.rand(12))
1306
1307 def test_ddof(self):
1308 # ddof raises DeprecationWarning
1309 x, y = self.data, self.data2
1310 expected = np.corrcoef(x)
1311 expected2 = np.corrcoef(x, y)
1312 with suppress_warnings() as sup:
1313 warnings.simplefilter("always")
1314 assert_warns(DeprecationWarning, corrcoef, x, ddof=-1)
1315 sup.filter(DeprecationWarning, "bias and ddof have no effect")
1316 # ddof has no or negligible effect on the function
1317 assert_almost_equal(np.corrcoef(x, ddof=0), corrcoef(x, ddof=0))
1318 assert_almost_equal(corrcoef(x, ddof=-1), expected)
1319 assert_almost_equal(corrcoef(x, y, ddof=-1), expected2)
1320 assert_almost_equal(corrcoef(x, ddof=3), expected)
1321 assert_almost_equal(corrcoef(x, y, ddof=3), expected2)
1322
1323 def test_bias(self):
1324 x, y = self.data, self.data2

Callers

nothing calls this directly

Calls 5

suppress_warningsClass · 0.90
assert_warnsFunction · 0.90
assert_almost_equalFunction · 0.90
corrcoefFunction · 0.90
filterMethod · 0.80

Tested by

no test coverage detected