Skip to content

Commit

Permalink
Add unit tests for zeta data
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewfullard committed Aug 28, 2024
1 parent e5f232d commit 223bb2d
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions carsus/io/tests/test_zeta.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import pytest
import pandas as pd
from carsus.io.zeta import KnoxLongZeta, ZETA_DATA_URL

@pytest.fixture
def reference_file_path():
return "carsus/data/knox_long_recombination_zeta.dat"

def test_knoxlongzeta_init_with_default_url():
zeta = KnoxLongZeta()
assert zeta.fname == ZETA_DATA_URL

def test_knoxlongzeta_init_with_custom_file(reference_file_path):
zeta = KnoxLongZeta(fname=reference_file_path)
assert zeta.fname == reference_file_path

def test_knoxlongzeta_prepare_data(reference_file_path):
zeta = KnoxLongZeta(reference_file_path)
zeta._prepare_data()

expected_columns = [float(i) for i in range(2000, 42000, 2000)]
assert isinstance(zeta.base, pd.DataFrame)
assert list(zeta.base.columns) == expected_columns
assert zeta.base.index.names == ["atomic_number", "ion_charge"]
assert zeta.version == "a1d4bed2982e8d6a4f8b0076bf637e49"

0 comments on commit 223bb2d

Please sign in to comment.