Exemplo n.º 1
0
 def test_where(self):
     from _numpypy import where, ones, zeros, array
     a = [1, 2, 3, 0, -3]
     a = where(array(a) > 0, ones(5), zeros(5))
     assert (a == [1, 1, 1, 0, 0]).all()
Exemplo n.º 2
0
 def test_where(self):
     from _numpypy import where, ones, zeros, array
     a = [1, 2, 3, 0, -3]
     a = where(array(a) > 0, ones(5), zeros(5))
     assert (a == [1, 1, 1, 0, 0]).all()
Exemplo n.º 3
0
 def test_where_invalidates(self):
     from _numpypy import where, ones, zeros, array
     a = array([1, 2, 3, 0, -3])
     b = where(a > 0, ones(5), zeros(5))
     a[0] = 0
     assert (b == [1, 1, 1, 0, 0]).all()
Exemplo n.º 4
0
 def test_where_invalidates(self):
     from _numpypy import where, ones, zeros, array
     a = array([1, 2, 3, 0, -3])
     b = where(a > 0, ones(5), zeros(5))
     a[0] = 0
     assert (b == [1, 1, 1, 0, 0]).all()