Skip to content

Commit

Permalink
Add rudimentary tests
Browse files Browse the repository at this point in the history
  • Loading branch information
grovduck committed Jul 10, 2024
1 parent 9d6650a commit 6589d82
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tests/test_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import pytest
from numpy.testing import assert_array_equal

from sknnr.datasets import load_moscow_stjoes, load_swo_ecoplot
from sknnr.datasets import load_csv_data, load_moscow_stjoes, load_swo_ecoplot


@dataclass
Expand All @@ -28,6 +28,20 @@ class DatasetConfiguration:
}


def test_passing_module_type():
"""Test that passing a module type to load_csv_data works."""
import sknnr.datasets.data as data_module

load_csv_data("moscow_env.csv", data_module=data_module)


def test_incorrect_module_raises_on_load_csv():
"""Test that load_csv_data raises when given an invalid module name."""
invalid_module = "sknnr.datasets.invalid_module"
with pytest.raises(ModuleNotFoundError, match="No module named"):
load_csv_data("moscow_env.csv", data_module=invalid_module)


@pytest.mark.parametrize(
"configuration", CONFIGURATIONS.values(), ids=CONFIGURATIONS.keys()
)
Expand Down

0 comments on commit 6589d82

Please sign in to comment.