Skip to content

Commit

Permalink
add smoke test for conserved quantity calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
wtbarnes committed Nov 7, 2024
1 parent fa84101 commit 43bfc03
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions pydrad/parse/tests/test_strand.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@
def strand(hydrad):
return Strand(hydrad)

@pytest.fixture
def strand_only_amr(hydrad):
return Strand(hydrad,
read_phy=False,
read_ine=False,
read_trm=False,
read_hstate=False)


def test_parse_initial_conditions(strand):
assert hasattr(strand, 'initial_conditions')

Expand All @@ -66,6 +75,23 @@ def test_has_quantity(strand, quantity):
assert isinstance(getattr(p, quantity), u.Quantity)


@pytest.mark.parametrize('quantity', [
'electron_temperature',
'ion_temperature',
'electron_density',
'ion_density',
'electron_pressure',
'ion_pressure',
'velocity',
])
def test_no_amr_run_has_quantity(strand_only_amr, quantity):
# check that Strand falls back to deriving thermodynamic quantities from
# conserved quantities when we do not read the phy files
for p in strand_only_amr:
assert hasattr(p, quantity)
assert isinstance(getattr(p, quantity), u.Quantity)


def test_time_arrays_same(hydrad, strand):
"""Check that reading time arrays different ways yields same answer"""
strand2 = Strand(hydrad, read_from_cfg=True)
Expand Down

0 comments on commit 43bfc03

Please sign in to comment.