Test proper casting for two different values.
(self)
| 44 | ) |
| 45 | |
| 46 | def test_two_values(self): |
| 47 | """Test proper casting for two different values.""" |
| 48 | # Broadcasting in the first dimension with numbers |
| 49 | expected = np.array([[3, 4]] * 10) |
| 50 | for x in ([3, 4], [[3, 4]]): |
| 51 | result = _as_pairs(x, 10) |
| 52 | assert_equal(result, expected) |
| 53 | # and with dtype=object |
| 54 | obj = object() |
| 55 | assert_equal( |
| 56 | _as_pairs(["a", obj], 10), |
| 57 | np.array([["a", obj]] * 10) |
| 58 | ) |
| 59 | |
| 60 | # Broadcasting in the second / last dimension with numbers |
| 61 | assert_equal( |
| 62 | _as_pairs([[3], [4]], 2), |
| 63 | np.array([[3, 3], [4, 4]]) |
| 64 | ) |
| 65 | # and with dtype=object |
| 66 | assert_equal( |
| 67 | _as_pairs([["a"], [obj]], 2), |
| 68 | np.array([["a", "a"], [obj, obj]]) |
| 69 | ) |
| 70 | |
| 71 | def test_with_none(self): |
| 72 | expected = ((None, None), (None, None), (None, None)) |
nothing calls this directly
no test coverage detected