()
| 50 | |
| 51 | |
| 52 | def 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)) |
nothing calls this directly
no test coverage detected