forked from ec-jrc/Thalassa
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
34 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from __future__ import annotations | ||
|
||
import pytest | ||
import xarray as xr | ||
|
||
from . import DATA_DIR | ||
from thalassa import api | ||
from thalassa import normalization | ||
from thalassa.normalization import THALASSA_FORMATS | ||
|
||
@pytest.mark.parametrize( | ||
"ds,expected_fmt", | ||
[ | ||
pytest.param(api.open_dataset(DATA_DIR / "fort.63.nc", normalize=False), THALASSA_FORMATS.ADCIRC, id="ADCIRC"), | ||
pytest.param(xr.Dataset(), THALASSA_FORMATS.UNKNOWN, id="Unknown"), | ||
], | ||
) | ||
def test_infer_format(ds, expected_fmt): | ||
fmt = normalization.infer_format(ds) | ||
assert fmt == expected_fmt | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"path,expected", | ||
[ | ||
pytest.param(DATA_DIR / "fort.63.nc", True, id="ADCIRC"), | ||
pytest.param(__file__, False, id="Unknown"), | ||
], | ||
) | ||
def test_can_be_inferred(path, expected): | ||
result = normalization.can_be_inferred(path) | ||
assert result == expected |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters