Skip to content

Commit

Permalink
MNT: Modify the exception tests to use the latest API. [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
Taher Chegini committed Oct 6, 2024
1 parent abda60d commit 3b67a88
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
3 changes: 2 additions & 1 deletion tests/test_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import pytest

import pynhd
from pynhd import NLDI, InputRangeError, InputValueError, ZeroMatchedError
from pynhd import NLDI
from pynhd.exceptions import InputRangeError, InputValueError, ZeroMatchedError


class TestNLDI:
Expand Down
15 changes: 11 additions & 4 deletions tests/test_pynhd.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def test_streamcat():
assert_close(nhd_area["INORGNWETDEP2008WS"].item(), 1.7746)


@pytest.mark.xfail(reason="EPA's HMS is unstable.")
def test_epa():
data = pynhd.epa_nhd_catchments(9533477, "curve_number")
assert_close(data["curve_number"].mean(axis=1), 75.576)
Expand Down Expand Up @@ -114,7 +115,6 @@ def test_elevation_profile(self):
assert_close(gdf.iloc[-1, 2], expected)
assert_close(gdfb.iloc[-1, 2], expected)

@pytest.mark.xfail(reason="The xs endpoints of PyGeoAPI are not working.")
def test_endpoints_profile(self):
coords = [(-103.801086, 40.26772), (-103.80097, 40.270568)]
gs = gpd.GeoDataFrame(
Expand Down Expand Up @@ -263,15 +263,22 @@ def test_multiple(self):
gcx = pynhd.GeoConnex()
gcx.item = "hu02"
h2 = gcx.byid("huc2", "02")
h3 = gcx.byid("huc2", "03")
h3 = gcx.byid("huc2", ("02", "03"))
assert (h2["gnis_id"] == 2730132).sum() == (h3["gnis_id"] == 2730133).sum() == 1

def test_many_features(self):
def test_many_features_box(self):
gcx = pynhd.GeoConnex(max_nfeatures=10)
gcx.item = "mainstems"
ms = gcx.bybox((-69.77, 45.07, -69.31, 45.45))
assert len(ms) == 24

@pytest.mark.xfail(reason="CQL is not working.")
def test_geom(self):
gcx = pynhd.GeoConnex()
ms = gcx.bygeometry((-69.77, 45.07, -69.31, 45.45))
assert len(ms) == 20
assert len(ms) == 24

@pytest.mark.xfail(reason="CQL is not working.")
def test_cql(self):
gcx = pynhd.GeoConnex("ua10")
awa = gcx.bycql({"gt": [{"property": "awater10"}, 100e6]})
Expand Down

0 comments on commit 3b67a88

Please sign in to comment.