Test results if `as_index=True`.
(self)
| 87 | ) |
| 88 | |
| 89 | def test_as_index(self): |
| 90 | """Test results if `as_index=True`.""" |
| 91 | assert_equal( |
| 92 | _as_pairs([2.6, 3.3], 10, as_index=True), |
| 93 | np.array([[3, 3]] * 10, dtype=np.intp) |
| 94 | ) |
| 95 | assert_equal( |
| 96 | _as_pairs([2.6, 4.49], 10, as_index=True), |
| 97 | np.array([[3, 4]] * 10, dtype=np.intp) |
| 98 | ) |
| 99 | for x in (-3, [-3], [[-3]], [-3, 4], [3, -4], [[-3, 4]], [[4, -3]], |
| 100 | [[1, 2]] * 9 + [[1, -2]]): |
| 101 | with pytest.raises(ValueError, match="negative values"): |
| 102 | _as_pairs(x, 10, as_index=True) |
| 103 | |
| 104 | def test_exceptions(self): |
| 105 | """Ensure faulty usage is discovered.""" |
nothing calls this directly
no test coverage detected