Skip to content

Commit

Permalink
test(loaders): Add test for load_sound_speed (#166)
Browse files Browse the repository at this point in the history
* test(loaders): Add test for load_sound_speed
* Improve unittest coverage for loaders.py `load_sound_speed()`
* Issue #124 #124

* * Verify data types of columns in svdf dataframe
  • Loading branch information
madhavmk authored Oct 11, 2023
1 parent 613925a commit 5b2c526
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion tests/test_loaders.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
from typing import Any, Dict

import pytest
from numpy import float64
from pandas import DataFrame

from gnatss.configs.main import Configuration
from gnatss.loaders import load_configuration
from gnatss.constants import SP_DEPTH, SP_SOUND_SPEED
from gnatss.loaders import load_configuration, load_sound_speed
from gnatss.main import gather_files
from tests import TEST_DATA_FOLDER


@pytest.fixture
def all_files_dict() -> Dict[str, Any]:
config = load_configuration(TEST_DATA_FOLDER / "config.yaml")
return gather_files(config)


@pytest.mark.parametrize(
"config_yaml_path",
[(None), (TEST_DATA_FOLDER / "invalid_config.yaml")],
Expand All @@ -22,3 +34,10 @@ def test_load_configuration_invalid_path(config_yaml_path):
def test_load_configuration_valid_path(config_yaml_path):
config = load_configuration(config_yaml_path)
assert isinstance(config, Configuration)


def test_load_sound_speed(all_files_dict):
svdf = load_sound_speed(all_files_dict["sound_speed"])
assert isinstance(svdf, DataFrame)
assert {SP_DEPTH, SP_SOUND_SPEED} == set(svdf.columns.values.tolist())
assert svdf.dtypes[SP_DEPTH] == float64 and svdf.dtypes[SP_SOUND_SPEED] == float64

0 comments on commit 5b2c526

Please sign in to comment.