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

Method test_oddfeatures_1

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

Source from the content-addressed store, hash-verified

709 assert_raises(MAError, lambda:int(a[0]))
710
711 def test_oddfeatures_1(self):
712 # Test of other odd features
713 x = arange(20)
714 x = x.reshape(4, 5)
715 x.flat[5] = 12
716 assert_(x[1, 0] == 12)
717 z = x + 10j * x
718 assert_equal(z.real, x)
719 assert_equal(z.imag, 10 * x)
720 assert_equal((z * conjugate(z)).real, 101 * x * x)
721 z.imag[...] = 0.0
722
723 x = arange(10)
724 x[3] = masked
725 assert_(str(x[3]) == str(masked))
726 c = x >= 8
727 assert_(count(where(c, masked, masked)) == 0)
728 assert_(shape(where(c, masked, masked)) == c.shape)
729
730 z = masked_where(c, x)
731 assert_(z.dtype is x.dtype)
732 assert_(z[3] is masked)
733 assert_(z[4] is not masked)
734 assert_(z[7] is not masked)
735 assert_(z[8] is masked)
736 assert_(z[9] is masked)
737 assert_equal(x, z)
738
739 def test_oddfeatures_2(self):
740 # Tests some more features.

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected