| 589 | (np.timedelta64(-2,'Y'), 0, np.timedelta64('Nat','Y')), |
| 590 | ]) |
| 591 | def test_division_int_timedelta(self, dividend, divisor, quotient): |
| 592 | # If either divisor is 0 or quotient is Nat, check for division by 0 |
| 593 | if divisor and (isinstance(quotient, int) or not np.isnat(quotient)): |
| 594 | msg = "Timedelta floor division check" |
| 595 | assert dividend // divisor == quotient, msg |
| 596 | |
| 597 | # Test for arrays as well |
| 598 | msg = "Timedelta arrays floor division check" |
| 599 | dividend_array = np.array([dividend]*5) |
| 600 | quotient_array = np.array([quotient]*5) |
| 601 | assert all(dividend_array // divisor == quotient_array), msg |
| 602 | else: |
| 603 | if IS_WASM: |
| 604 | pytest.skip("fp errors don't work in wasm") |
| 605 | with np.errstate(divide='raise', invalid='raise'): |
| 606 | with pytest.raises(FloatingPointError): |
| 607 | dividend // divisor |
| 608 | |
| 609 | def test_division_complex(self): |
| 610 | # check that implementation is correct |