Skip to content

Commit b6753a2

Browse files
committed
Update samples tests
1 parent 01adcc4 commit b6753a2

2 files changed

Lines changed: 19 additions & 19 deletions

File tree

dataretrieval/samples.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,8 @@ def get_usgs_samples(
321321
return df, BaseMetadata(response)
322322

323323
def _check_profiles(
324-
service: str,
325-
profile: str,
324+
service: _SERVICES,
325+
profile: _PROFILES,
326326
) -> None:
327327
"""Check whether a service profile is valid.
328328

tests/samples_test.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from dataretrieval.samples import (
77
_check_profiles,
8-
get_USGS_samples
8+
get_usgs_samples
99
)
1010

1111
def mock_request(requests_mock, request_url, file_path):
@@ -15,7 +15,7 @@ def mock_request(requests_mock, request_url, file_path):
1515
request_url, text=text.read(), headers={"mock_header": "value"}
1616
)
1717

18-
def test_mock_get_USGS_samples(requests_mock):
18+
def test_mock_get_usgs_samples(requests_mock):
1919
"""Tests USGS Samples query"""
2020
request_url = (
2121
"https://api.waterdata.usgs.gov/samples-data/results/fullphyschem?"
@@ -24,14 +24,14 @@ def test_mock_get_USGS_samples(requests_mock):
2424
)
2525
response_file_path = "data/samples_results.txt"
2626
mock_request(requests_mock, request_url, response_file_path)
27-
df, md = get_USGS_samples(
28-
service="results",
29-
profile="fullphyschem",
30-
activityMediaName="Water",
31-
activityStartDateLower="2020-01-01",
32-
activityStartDateUpper="2024-12-31",
33-
monitoringLocationIdentifier="USGS-05406500"
34-
)
27+
df, md = get_usgs_samples(
28+
service="results",
29+
profile="fullphyschem",
30+
activityMediaName="Water",
31+
activityStartDateLower="2020-01-01",
32+
activityStartDateUpper="2024-12-31",
33+
monitoringLocationIdentifier="USGS-05406500",
34+
)
3535
assert type(df) is DataFrame
3636
assert df.size == 12127
3737
assert md.url == request_url
@@ -41,14 +41,14 @@ def test_mock_get_USGS_samples(requests_mock):
4141

4242
def test_check_profiles():
4343
"""Tests that correct errors are raised for invalid profiles."""
44-
with pytest.raises(TypeError):
44+
with pytest.raises(ValueError):
4545
_check_profiles(service="foo", profile="bar")
46-
with pytest.raises(TypeError):
46+
with pytest.raises(ValueError):
4747
_check_profiles(service="results", profile="foo")
4848

4949
def test_samples_results():
5050
"""Test results call for proper columns"""
51-
df,_ = get_USGS_samples(
51+
df,_ = get_usgs_samples(
5252
service="results",
5353
profile="narrow",
5454
monitoringLocationIdentifier="USGS-05288705",
@@ -60,7 +60,7 @@ def test_samples_results():
6060

6161
def test_samples_activity():
6262
"""Test activity call for proper columns"""
63-
df,_ = get_USGS_samples(
63+
df,_ = get_usgs_samples(
6464
service="activities",
6565
profile="sampact",
6666
monitoringLocationIdentifier="USGS-06719505"
@@ -71,7 +71,7 @@ def test_samples_activity():
7171

7272
def test_samples_locations():
7373
"""Test locations call for proper columns"""
74-
df,_ = get_USGS_samples(
74+
df,_ = get_usgs_samples(
7575
service="locations",
7676
profile="site",
7777
stateFips="US:55",
@@ -84,7 +84,7 @@ def test_samples_locations():
8484

8585
def test_samples_projects():
8686
"""Test projects call for proper columns"""
87-
df,_ = get_USGS_samples(
87+
df,_ = get_usgs_samples(
8888
service="projects",
8989
profile="project",
9090
stateFips="US:15",
@@ -96,7 +96,7 @@ def test_samples_projects():
9696

9797
def test_samples_organizations():
9898
"""Test organizations call for proper columns"""
99-
df,_ = get_USGS_samples(
99+
df,_ = get_usgs_samples(
100100
service="organizations",
101101
profile="count",
102102
stateFips="US:01"

0 commit comments

Comments
 (0)