예제 #1
0
    def test_square(self):
        import math
        from numpypy import square

        nan, inf, ninf = float("nan"), float("inf"), float("-inf")

        assert math.isnan(square(nan))
        assert math.isinf(square(inf))
        assert math.isinf(square(ninf))
        assert square(ninf) > 0
        assert [square(x) for x in range(-5, 5)] == [x*x for x in range(-5, 5)]
        assert math.isinf(square(1e300))
예제 #2
0
 def test_square(self):
     from numpypy import square
     assert square(complex(3, 4)) == complex(3,4) * complex(3, 4)