Skip to content

Commit 0f26510

Browse files
thodson-usgsclaude
andcommitted
Drop trivial regression tests from nldi cleanup
The trim_start drop, falsy-zero (lat/long/comid), and unbalanced-quote fixes are each one-line changes whose regressions are obvious on read. The remaining three tests (search-without-nav-mode crash, ValueError vs TypeError, and lowercase normalization) cover behavior that's less self-evident from the code. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent f8d0a3f commit 0f26510

1 file changed

Lines changed: 0 additions & 53 deletions

File tree

tests/nldi_test.py

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -302,56 +302,3 @@ def test_validate_navigation_mode_raises_value_error_for_invalid():
302302
def test_validate_navigation_mode_normalizes_lowercase():
303303
"""Regression: lowercase values used to validate but be sent unchanged."""
304304
assert _validate_navigation_mode("um") == "UM"
305-
306-
307-
def test_get_flowlines_by_comid_includes_trim_start(requests_mock):
308-
"""Regression: trim_start was previously dropped on the comid code path."""
309-
request_url = f"{NLDI_API_BASE_URL}/comid/13294314/navigation/UM/flowlines"
310-
response_file_path = "tests/data/nldi_get_flowlines_by_comid.json"
311-
mock_request(requests_mock, request_url, response_file_path)
312-
313-
get_flowlines(navigation_mode="UM", comid=13294314, trim_start=True)
314-
315-
sent = requests_mock.request_history[-1]
316-
assert sent.qs.get("trimstart") == ["true"]
317-
318-
319-
def test_get_features_with_zero_coordinates(requests_mock):
320-
"""Regression: lat=0.0 / long=0.0 were treated as missing (falsy bug)."""
321-
request_url = f"{NLDI_API_BASE_URL}/comid/position"
322-
requests_mock.get(
323-
request_url,
324-
json={"type": "FeatureCollection", "features": []},
325-
headers={"mock_header": "value"},
326-
)
327-
328-
gdf = get_features(lat=0.0, long=0.0, as_json=True)
329-
assert isinstance(gdf, dict)
330-
sent = requests_mock.request_history[-1]
331-
assert "POINT(0.0 0.0)" in sent.qs.get("coords", [""])[0].upper()
332-
333-
334-
def test_get_features_lat_zero_long_missing_raises():
335-
"""Regression: lat=0.0 with missing long was silently accepted (falsy bug)."""
336-
with pytest.raises(ValueError, match="Both lat and long are required"):
337-
get_features(lat=0.0)
338-
339-
340-
def test_get_features_error_message_has_balanced_quotes(requests_mock):
341-
"""Regression: error message had a missing closing quote after feature_id."""
342-
request_url = f"{NLDI_API_BASE_URL}/WQP/USGS-bad/navigation/UM/nwissite"
343-
# Use a status code utils.query() doesn't intercept so the _query_nldi
344-
# error path runs and we see its formatted message.
345-
requests_mock.get(request_url, status_code=403, reason="Forbidden", json={})
346-
mock_request_data_sources(requests_mock)
347-
348-
with pytest.raises(ValueError) as exc:
349-
get_features(
350-
feature_source="WQP",
351-
feature_id="USGS-bad",
352-
data_source="nwissite",
353-
navigation_mode="UM",
354-
)
355-
msg = str(exc.value)
356-
# Closing quote after feature_id must now be present.
357-
assert "feature_id 'USGS-bad'," in msg

0 commit comments

Comments
 (0)