Skip to content

Commit c9cbe67

Browse files
committed
add more samples tests
1 parent bc5d177 commit c9cbe67

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

tests/samples_test.py

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
)
1010

1111
def mock_request(requests_mock, request_url, file_path):
12+
"""Mock request code"""
1213
with open(file_path) as text:
1314
requests_mock.get(
1415
request_url, text=text.read(), headers={"mock_header": "value"}
@@ -45,6 +46,18 @@ def test_check_profiles():
4546
with pytest.raises(TypeError):
4647
_check_profiles(service="results", profile="foo")
4748

49+
def test_samples_results():
50+
"""Test results call for proper columns"""
51+
df,_ = get_USGS_samples(
52+
service="results",
53+
profile="narrow",
54+
monitoringLocationIdentifier="USGS-05288705",
55+
activityStartDateLower="2024-10-01",
56+
activityStartDateUpper="2025-04-24"
57+
)
58+
assert all(col in df.columns for col in ["Location_Identifier", "Activity_ActivityIdentifier"])
59+
assert len(df) > 0
60+
4861
def test_samples_activity():
4962
"""Test activity call for proper columns"""
5063
df,_ = get_USGS_samples(
@@ -55,3 +68,38 @@ def test_samples_activity():
5568
assert len(df) > 0
5669
assert len(df.columns) == 95
5770
assert "Location_HUCTwelveDigitCode" in df.columns
71+
72+
def test_samples_locations():
73+
"""Test locations call for proper columns"""
74+
df,_ = get_USGS_samples(
75+
service="locations",
76+
profile="site",
77+
stateFips="US:55",
78+
activityStartDateLower="2024-10-01",
79+
activityStartDateUpper="2025-04-24",
80+
usgsPCode="00010"
81+
)
82+
assert all(col in df.columns for col in ["Location_Identifier", "Location_Latitude"])
83+
assert len(df) > 0
84+
85+
def test_samples_projects():
86+
"""Test projects call for proper columns"""
87+
df,_ = get_USGS_samples(
88+
service="projects",
89+
profile="project",
90+
stateFips="US:15",
91+
activityStartDateLower="2024-10-01",
92+
activityStartDateUpper="2025-04-24"
93+
)
94+
assert all(col in df.columns for col in ["Org_Identifier", "Project_Identifier"])
95+
assert len(df) > 0
96+
97+
def test_samples_organizations():
98+
"""Test organizations call for proper columns"""
99+
df,_ = get_USGS_samples(
100+
service="organizations",
101+
profile="count",
102+
stateFips="US:01"
103+
)
104+
assert len(df) == 1
105+
assert df.size == 3

0 commit comments

Comments
 (0)