MCPcopy Index your code
hub / github.com/numpy/numpy / test_object_direct

Method test_object_direct

numpy/_core/tests/test_umath.py:4360–4375  ·  view source on GitHub ↗

test direct implementation of these magic methods

(self)

Source from the content-addressed store, hash-verified

4358class 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__ """

Callers

nothing calls this directly

Calls 2

assert_equalFunction · 0.90
CClass · 0.70

Tested by

no test coverage detected