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

Method test_oddfeatures_1

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

Source from the content-addressed store, hash-verified

804 assert_raises(MAError, lambda: int(a[0]))
805
806 def test_oddfeatures_1(self):
807 # Test of other odd features
808 x = arange(20)
809 x = x.reshape(4, 5)
810 x.flat[5] = 12
811 assert_(x[1, 0] == 12)
812 z = x + 10j * x
813 assert_equal(z.real, x)
814 assert_equal(z.imag, 10 * x)
815 assert_equal((z * conjugate(z)).real, 101 * x * x)
816 z.imag[...] = 0.0
817
818 x = arange(10)
819 x[3] = masked
820 assert_(str(x[3]) == str(masked))
821 c = x >= 8
822 assert_(count(where(c, masked, masked)) == 0)
823 assert_(shape(where(c, masked, masked)) == c.shape)
824
825 z = masked_where(c, x)
826 assert_(z.dtype is x.dtype)
827 assert_(z[3] is masked)
828 assert_(z[4] is not masked)
829 assert_(z[7] is not masked)
830 assert_(z[8] is masked)
831 assert_(z[9] is masked)
832 assert_equal(x, z)
833
834 def test_oddfeatures_2(self):
835 # Tests some more features.

Callers

nothing calls this directly

Calls 7

assert_equalFunction · 0.90
countFunction · 0.90
whereFunction · 0.90
shapeFunction · 0.90
masked_whereFunction · 0.90
assert_Function · 0.85
reshapeMethod · 0.80

Tested by

no test coverage detected