test direct implementation of these magic methods
(self)
| 4358 | class TestRoundingFunctions: |
| 4359 | |
| 4360 | def test_object_direct(self): |
| 4361 | """ test direct implementation of these magic methods """ |
| 4362 | class C: |
| 4363 | def __floor__(self): |
| 4364 | return 1 |
| 4365 | |
| 4366 | def __ceil__(self): |
| 4367 | return 2 |
| 4368 | |
| 4369 | def __trunc__(self): |
| 4370 | return 3 |
| 4371 | |
| 4372 | arr = np.array([C(), C()]) |
| 4373 | assert_equal(np.floor(arr), [1, 1]) |
| 4374 | assert_equal(np.ceil(arr), [2, 2]) |
| 4375 | assert_equal(np.trunc(arr), [3, 3]) |
| 4376 | |
| 4377 | def test_object_indirect(self): |
| 4378 | """ test implementations via __float__ """ |
nothing calls this directly
no test coverage detected