MCPcopy Create free account
hub / github.com/PyO3/rust-numpy / test_polymorphic_add

Function test_polymorphic_add

examples/simple/tests/test_ext.py:52–66  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

50
51
52def test_polymorphic_add():
53 x = np.array([1.0, 2.0, 3.0], dtype=np.double)
54 y = np.array([3.0, 3.0, 3.0], dtype=np.double)
55 z = polymorphic_add(x, y)
56 np.testing.assert_array_almost_equal(z, np.array([4.0, 5.0, 6.0], dtype=np.double))
57
58 x = np.array([1, 2, 3], dtype=np.int64)
59 y = np.array([3, 3, 3], dtype=np.int64)
60 z = polymorphic_add(x, y)
61 assert np.all(z == np.array([4, 5, 6], dtype=np.int64))
62
63 x = np.array([1.0, 2.0, 3.0], dtype=np.double)
64 y = np.array([3, 3, 3], dtype=np.int64)
65 z = polymorphic_add(x, y)
66 np.testing.assert_array_almost_equal(z, np.array([4.0, 5.0, 6.0], dtype=np.double))

Callers

nothing calls this directly

Calls 2

polymorphic_addFunction · 0.85
arrayMethod · 0.80

Tested by

no test coverage detected