summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGanesh Kathiresan <ganesh3597@gmail.com>2021-05-29 23:04:36 +0530
committerGanesh Kathiresan <ganesh3597@gmail.com>2021-05-29 23:20:32 +0530
commit2ad9dd738e74239d1d406ae803aa00f61336d016 (patch)
tree77cb90bfa8d9df8b37e08165e6be4e6ab362603b
parentfcf4749ae97c8c46a28abb02e099ffd59a4c426b (diff)
downloadnumpy-2ad9dd738e74239d1d406ae803aa00f61336d016.tar.gz
TST: Changed TC to check for `TypeError` in floor divide | Added asserts for divmod and remainder
-rw-r--r--numpy/core/tests/test_umath.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/numpy/core/tests/test_umath.py b/numpy/core/tests/test_umath.py
index 9d1b13b53..f438b622a 100644
--- a/numpy/core/tests/test_umath.py
+++ b/numpy/core/tests/test_umath.py
@@ -418,16 +418,14 @@ class TestDivision:
assert_(np.isnan(y)[0])
def test_floor_division_complex(self):
- # check that implementation is correct
- msg = "Complex floor division implementation check"
+ # check that floor division, divmod and remainder raises type errors
x = np.array([.9 + 1j, -.1 + 1j, .9 + .5*1j, .9 + 2.*1j], dtype=np.complex128)
- y = np.array([0., -1., 0., 0.], dtype=np.complex128)
- assert_equal(np.floor_divide(x**2, x), y, err_msg=msg)
- # check overflow, underflow
- msg = "Complex floor division overflow/underflow check"
- x = np.array([1.e+110, 1.e-110], dtype=np.complex128)
- y = np.floor_divide(x**2, x)
- assert_equal(y, [1.e+110, 0], err_msg=msg)
+ with pytest.raises(TypeError):
+ x // 7
+ with pytest.raises(TypeError):
+ np.divmod(x, 7)
+ with pytest.raises(TypeError):
+ np.remainder(x, 7)
def test_floor_division_signed_zero(self):
# Check that the sign bit is correctly set when dividing positive and