test implementations via __float__
(self)
| 4375 | assert_equal(np.trunc(arr), [3, 3]) |
| 4376 | |
| 4377 | def test_object_indirect(self): |
| 4378 | """ test implementations via __float__ """ |
| 4379 | class C: |
| 4380 | def __float__(self): |
| 4381 | return -2.5 |
| 4382 | |
| 4383 | arr = np.array([C(), C()]) |
| 4384 | assert_equal(np.floor(arr), [-3, -3]) |
| 4385 | assert_equal(np.ceil(arr), [-2, -2]) |
| 4386 | with pytest.raises(TypeError): |
| 4387 | np.trunc(arr) # consistent with math.trunc |
| 4388 | |
| 4389 | def test_fraction(self): |
| 4390 | f = Fraction(-4, 3) |
nothing calls this directly
no test coverage detected