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

Method test_masked

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

Source from the content-addressed store, hash-verified

1030 assert_(dx.dtype == np.dtype('timedelta64[D]'))
1031
1032 def test_masked(self):
1033 # Make sure that gradient supports subclasses like masked arrays
1034 x = np.ma.array([[1, 1], [3, 4]],
1035 mask=[[False, False], [False, False]])
1036 out = gradient(x)[0]
1037 assert_equal(type(out), type(x))
1038 # And make sure that the output and input don't have aliased mask
1039 # arrays
1040 assert_(x._mask is not out._mask)
1041 # Also check that edge_order=2 doesn't alter the original mask
1042 x2 = np.ma.arange(5)
1043 x2[2] = np.ma.masked
1044 np.gradient(x2, edge_order=2)
1045 assert_array_equal(x2.mask, [False, False, True, False, False])
1046
1047 def test_second_order_accurate(self):
1048 # 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