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

Method test_var

numpy/_core/tests/test_numeric.py:360–373  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

358 assert_equal(np.matrix_transpose(arr), tgt)
359
360 def test_var(self):
361 A = [[1, 2, 3], [4, 5, 6]]
362 assert_almost_equal(np.var(A), 2.9166666666666665)
363 assert_almost_equal(np.var(A, 0), np.array([2.25, 2.25, 2.25]))
364 assert_almost_equal(np.var(A, 1), np.array([0.66666667, 0.66666667]))
365
366 with warnings.catch_warnings(record=True) as w:
367 warnings.filterwarnings('always', '', RuntimeWarning)
368 assert_(np.isnan(np.var([])))
369 assert_(w[0].category is RuntimeWarning)
370
371 B = np.array([None, 0])
372 B[0] = 1j
373 assert_almost_equal(np.var(B), 0.25)
374
375 def test_std_with_mean_keyword(self):
376 # Setting the seed to make the test reproducible

Callers

nothing calls this directly

Calls 3

assert_almost_equalFunction · 0.90
assert_Function · 0.90
varMethod · 0.45

Tested by

no test coverage detected