(self)
| 706 | class TestRemainder: |
| 707 | |
| 708 | def test_remainder_basic(self): |
| 709 | dt = np.typecodes['AllInteger'] + np.typecodes['Float'] |
| 710 | for op in [floor_divide_and_remainder, np.divmod]: |
| 711 | for dt1, dt2 in itertools.product(dt, dt): |
| 712 | for sg1, sg2 in itertools.product(_signs(dt1), _signs(dt2)): |
| 713 | fmt = 'op: %s, dt1: %s, dt2: %s, sg1: %s, sg2: %s' |
| 714 | msg = fmt % (op.__name__, dt1, dt2, sg1, sg2) |
| 715 | a = np.array(sg1*71, dtype=dt1) |
| 716 | b = np.array(sg2*19, dtype=dt2) |
| 717 | div, rem = op(a, b) |
| 718 | assert_equal(div*b + rem, a, err_msg=msg) |
| 719 | if sg2 == -1: |
| 720 | assert_(b < rem <= 0, msg) |
| 721 | else: |
| 722 | assert_(b > rem >= 0, msg) |
| 723 | |
| 724 | def test_float_remainder_exact(self): |
| 725 | # test that float results are exact for small integers. This also |
nothing calls this directly
no test coverage detected