|
17 | 17 | T = TypeVar('T') |
18 | 18 |
|
19 | 19 |
|
20 | | -@pytest.mark.parametrize('target,test_shape', |
21 | | - [((None, ), (1, 3)), |
22 | | - ((None, 3), (1,)), |
23 | | - ((None, 3), (1, 2)), |
24 | | - ((1, 5), (1, 9)), |
25 | | - ((None, 2, None), (1, 3, 1)) |
| 20 | +@pytest.mark.parametrize('target,shape_repr,test_shape', |
| 21 | + [((None, ), "(N,)", (1, 3)), |
| 22 | + ((None, 3), "(N, 3)", (1,)), |
| 23 | + ((None, 3), "(N, 3)", (1, 2)), |
| 24 | + ((1, 5), "(1, 5)", (1, 9)), |
| 25 | + ((None, 2, None), "(M, 2, N)", (1, 3, 1)) |
26 | 26 | ]) |
27 | 27 | def test_check_shape(target: tuple[int | None, ...], |
| 28 | + shape_repr: str, |
28 | 29 | test_shape: tuple[int, ...]) -> None: |
29 | | - error_pattern = (f"^'aardvark' must be {len(target)}D.*" + |
30 | | - re.escape(f'has shape {test_shape}')) |
| 30 | + error_pattern = "^" + re.escape( |
| 31 | + f"'aardvark' must be {len(target)}D with shape {shape_repr}, but your input " |
| 32 | + f"has shape {test_shape}") |
31 | 33 | data = np.zeros(test_shape) |
32 | 34 | with pytest.raises(ValueError, match=error_pattern): |
33 | 35 | _api.check_shape(target, aardvark=data) |
|
0 commit comments