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

Method test_fweights

numpy/lib/tests/test_function_base.py:2370–2384  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2368 assert_allclose(cov(self.x3, ddof=1), np.var(self.x3, ddof=1))
2369
2370 def test_fweights(self):
2371 assert_allclose(cov(self.x2, fweights=self.frequencies),
2372 cov(self.x2_repeats))
2373 assert_allclose(cov(self.x1, fweights=self.frequencies),
2374 self.res2)
2375 assert_allclose(cov(self.x1, fweights=self.unit_frequencies),
2376 self.res1)
2377 nonint = self.frequencies + 0.5
2378 assert_raises(TypeError, cov, self.x1, fweights=nonint)
2379 f = np.ones((2, 3), dtype=np.int_)
2380 assert_raises(RuntimeError, cov, self.x1, fweights=f)
2381 f = np.ones(2, dtype=np.int_)
2382 assert_raises(RuntimeError, cov, self.x1, fweights=f)
2383 f = -1 * np.ones(3, dtype=np.int_)
2384 assert_raises(ValueError, cov, self.x1, fweights=f)
2385
2386 def test_aweights(self):
2387 assert_allclose(cov(self.x1, aweights=self.weights), self.res3)

Callers

nothing calls this directly

Calls 3

assert_allcloseFunction · 0.90
covFunction · 0.90
assert_raisesFunction · 0.90

Tested by

no test coverage detected