def test_basic(self): a = np.random.rand(10) b = real_if_close(a+1e-15j) assert_all(isrealobj(b)) assert_array_equal(a, b) b = real_if_close(a+1e-7j) assert_all(iscomplexobj(b)) b = real_if_close(a+1e-7j, tol=1e-6) assert_all(isrealobj(b))
def test_basic(self): a = np.random.rand(10) b = real_if_close(a + 1e-15j) assert_all(isrealobj(b)) assert_array_equal(a, b) b = real_if_close(a + 1e-7j) assert_all(iscomplexobj(b)) b = real_if_close(a + 1e-7j, tol=1e-6) assert_all(isrealobj(b))
def test_basic(self): z = np.array([-1, 0, 1]) assert_(isrealobj(z)) z = np.array([-1j, 0, -1]) assert_(not isrealobj(z))