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

Method test_numpyarithmetic

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

Source from the content-addressed store, hash-verified

1907 [False, True]])
1908
1909 def test_numpyarithmetic(self):
1910 # Check that the mask is not back-propagated when using numpy functions
1911 a = masked_array([-1, 0, 1, 2, 3], mask=[0, 0, 0, 0, 1])
1912 control = masked_array([np.nan, np.nan, 0, np.log(2), -1],
1913 mask=[1, 1, 0, 0, 1])
1914
1915 test = log(a)
1916 assert_equal(test, control)
1917 assert_equal(test.mask, control.mask)
1918 assert_equal(a.mask, [0, 0, 0, 0, 1])
1919
1920 test = np.log(a)
1921 assert_equal(test, control)
1922 assert_equal(test.mask, control.mask)
1923 assert_equal(a.mask, [0, 0, 0, 0, 1])
1924
1925
1926class TestMaskedArrayAttributes:

Callers

nothing calls this directly

Calls 2

assert_equalFunction · 0.90
logFunction · 0.50

Tested by

no test coverage detected