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