Skip to content

Commit

Permalink
Testing absolute path in DataSource.
Browse files Browse the repository at this point in the history
  • Loading branch information
vitenti committed Oct 29, 2024
1 parent 2399c58 commit ce94a1b
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/likelihood/test_factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,37 @@ def test_data_source_sacc_dict() -> None:
data_source_sacc = DataSourceSacc.model_validate(data_source_sacc_dict)
assert isinstance(data_source_sacc, DataSourceSacc)
assert data_source_sacc.sacc_data_file == "tests/bug_398.sacc.gz"
sacc_data = data_source_sacc.get_sacc_data()
assert sacc_data is not None
assert isinstance(sacc_data, sacc.Sacc)


def test_data_source_sacc_dict_absolute() -> None:
sacc_file = Path("tests/bug_398.sacc.gz").absolute()
data_source_sacc_dict = {"sacc_data_file": sacc_file.as_posix()}
data_source_sacc = DataSourceSacc.model_validate(data_source_sacc_dict)
assert isinstance(data_source_sacc, DataSourceSacc)
assert data_source_sacc.sacc_data_file == sacc_file.as_posix()
sacc_data = data_source_sacc.get_sacc_data()
assert sacc_data is not None
assert isinstance(sacc_data, sacc.Sacc)


def test_data_source_sacc_direct() -> None:
data_source_sacc = DataSourceSacc(sacc_data_file="tests/bug_398.sacc.gz")
assert data_source_sacc.sacc_data_file == "tests/bug_398.sacc.gz"
sacc_data = data_source_sacc.get_sacc_data()
assert sacc_data is not None
assert isinstance(sacc_data, sacc.Sacc)


def test_data_source_sacc_direct_absolute() -> None:
sacc_file = Path("tests/bug_398.sacc.gz").absolute()
data_source_sacc = DataSourceSacc(sacc_data_file=sacc_file.as_posix())
assert data_source_sacc.sacc_data_file == sacc_file.as_posix()
sacc_data = data_source_sacc.get_sacc_data()
assert sacc_data is not None
assert isinstance(sacc_data, sacc.Sacc)


def test_data_source_sacc_invalid_file() -> None:
Expand Down

0 comments on commit ce94a1b

Please sign in to comment.