test direct implementation of these magic methods
(self)
| 4061 | class TestRoundingFunctions: |
| 4062 | |
| 4063 | def test_object_direct(self): |
| 4064 | """ test direct implementation of these magic methods """ |
| 4065 | class C: |
| 4066 | def __floor__(self): |
| 4067 | return 1 |
| 4068 | def __ceil__(self): |
| 4069 | return 2 |
| 4070 | def __trunc__(self): |
| 4071 | return 3 |
| 4072 | |
| 4073 | arr = np.array([C(), C()]) |
| 4074 | assert_equal(np.floor(arr), [1, 1]) |
| 4075 | assert_equal(np.ceil(arr), [2, 2]) |
| 4076 | assert_equal(np.trunc(arr), [3, 3]) |
| 4077 | |
| 4078 | def test_object_indirect(self): |
| 4079 | """ test implementations via __float__ """ |
nothing calls this directly
no test coverage detected