|
14 | 14 | CoordError, |
15 | 15 | ParameterError, |
16 | 16 | PatchBroadcastError, |
| 17 | + PatchCoordinateError, |
17 | 18 | PatchError, |
18 | 19 | ) |
19 | 20 | from dascore.units import get_quantity |
@@ -321,6 +322,33 @@ def test_patch_non_coord(self, random_patch): |
321 | 322 | new = patch.select(face_angle=(face_angle.min(), face_angle.max())) |
322 | 323 | assert new == patch |
323 | 324 |
|
| 325 | + def test_select_nonexistent_coordinate_raises_error(self, random_patch): |
| 326 | + """ |
| 327 | + Test that selecting on a non-existing coordinate |
| 328 | + raises PatchCoordinateError. |
| 329 | + """ |
| 330 | + # Try to select on a coordinate that doesn't exist |
| 331 | + with pytest.raises(PatchCoordinateError, match="nonexistent_coord"): |
| 332 | + random_patch.select(nonexistent_coord=(0, 10)) |
| 333 | + |
| 334 | + def test_select_multiple_nonexistent_coordinates_raises_error(self, random_patch): |
| 335 | + """ |
| 336 | + Test that selecting on multiple non-existing coordinates raises |
| 337 | + PatchCoordinateError. |
| 338 | + """ |
| 339 | + # Try to select on multiple coordinates that don't exist |
| 340 | + with pytest.raises(PatchCoordinateError, match="coord1.*coord2"): |
| 341 | + random_patch.select(bad_coord1=(0, 10), bad_coord2=(5, 15)) |
| 342 | + |
| 343 | + def test_select_mix_valid_invalid_coordinates_raises_error(self, random_patch): |
| 344 | + """ |
| 345 | + Test that mixing valid and invalid coordinates raises |
| 346 | + PatchCoordinateError. |
| 347 | + """ |
| 348 | + # Try to select on a mix of valid and invalid coordinates |
| 349 | + with pytest.raises(PatchCoordinateError, match="invalid_coord"): |
| 350 | + random_patch.select(time=(0, 1), invalid_coord=(0, 10)) |
| 351 | + |
324 | 352 |
|
325 | 353 | class TestOrder: |
326 | 354 | """Tests for ordering Patches.""" |
|
0 commit comments