Skip to content

Commit

Permalink
MNT: Add tests for the new recession function. [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
Taher Chegini committed Jul 7, 2024
1 parent 07b6b91 commit 640a1a2
Show file tree
Hide file tree
Showing 2 changed files with 7,318 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/test_hydrosignatures.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ def datasets() -> tuple[pd.Series, pd.Series, dict[str, Any]]:
return df.q_mmpd, df.p_mmpd, sig_expected


@pytest.fixture()
def streamflow() -> tuple[pd.Series, pd.Series, dict[str, Any]]:
return pd.read_csv(Path("tests", "test_streamflow.csv"), index_col=0).squeeze()


@pytest.mark.speedup()
def test_signatures(datasets):
q_mmpd, p_mmpd, sig_expected = datasets
Expand All @@ -36,6 +41,13 @@ def test_signatures(datasets):
assert np.allclose(pd.DataFrame(mm), sig.values.mean_monthly)


@pytest.mark.speedup()
def test_recession(streamflow):
mrc, k = hs.baseflow_recession(streamflow)
assert_close(mrc.max(), 70.7921)
assert_close(k, 0.0560)


def test_show_versions():
f = io.StringIO()
hs.show_versions(file=f)
Expand Down
Loading

0 comments on commit 640a1a2

Please sign in to comment.