예제 #1
0
    def test_true_divide(self):
        from _numpypy import array, true_divide

        a = array([0, 1, 2, 3, 4, 1, -1])
        b = array([4, 4, 4, 4, 4, 0,  0])
        c = true_divide(a, b)
        assert (c == [0.0, 0.25, 0.5, 0.75, 1.0, float('inf'), float('-inf')]).all()

        assert math.isnan(true_divide(0, 0))
예제 #2
0
    def test_true_divide(self):
        from _numpypy import array, true_divide

        a = array([0, 1, 2, 3, 4, 1, -1])
        b = array([4, 4, 4, 4, 4, 0, 0])
        c = true_divide(a, b)
        assert (c == [0.0, 0.25, 0.5, 0.75, 1.0,
                      float('inf'),
                      float('-inf')]).all()

        assert math.isnan(true_divide(0, 0))
예제 #3
0
 def test_true_divide(self):
     from _numpypy import arange, array, true_divide
     assert (true_divide(arange(3), array([2, 2, 2])) == array([0, 0.5, 1])).all()
예제 #4
0
 def test_true_divide(self):
     from _numpypy import arange, array, true_divide
     assert (true_divide(arange(3), array([2, 2, 2])) == array([0, 0.5,
                                                                1])).all()