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

Method test_masked

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

Source from the content-addressed store, hash-verified

1171 assert_(dx.dtype == np.dtype('timedelta64[D]'))
1172
1173 def test_masked(self):
1174 # Make sure that gradient supports subclasses like masked arrays
1175 x = np.ma.array([[1, 1], [3, 4]],
1176 mask=[[False, False], [False, False]])
1177 out = gradient(x)[0]
1178 assert_equal(type(out), type(x))
1179 # And make sure that the output and input don't have aliased mask
1180 # arrays
1181 assert_(x._mask is not out._mask)
1182 # Also check that edge_order=2 doesn't alter the original mask
1183 x2 = np.ma.arange(5)
1184 x2[2] = np.ma.masked
1185 np.gradient(x2, edge_order=2)
1186 assert_array_equal(x2.mask, [False, False, True, False, False])
1187
1188 def test_second_order_accurate(self):
1189 # Testing that the relative numerical error is less that 3% for

Callers

nothing calls this directly

Calls 4

gradientFunction · 0.90
assert_equalFunction · 0.90
assert_Function · 0.90
assert_array_equalFunction · 0.90

Tested by

no test coverage detected