test implementations via __float__
(self)
| 4076 | assert_equal(np.trunc(arr), [3, 3]) |
| 4077 | |
| 4078 | def test_object_indirect(self): |
| 4079 | """ test implementations via __float__ """ |
| 4080 | class C: |
| 4081 | def __float__(self): |
| 4082 | return -2.5 |
| 4083 | |
| 4084 | arr = np.array([C(), C()]) |
| 4085 | assert_equal(np.floor(arr), [-3, -3]) |
| 4086 | assert_equal(np.ceil(arr), [-2, -2]) |
| 4087 | with pytest.raises(TypeError): |
| 4088 | np.trunc(arr) # consistent with math.trunc |
| 4089 | |
| 4090 | def test_fraction(self): |
| 4091 | f = Fraction(-4, 3) |
nothing calls this directly
no test coverage detected