Skip to content

Commit

Permalink
Adding barebone structure for testing check_simulation_env()
Browse files Browse the repository at this point in the history
  • Loading branch information
DhruvSondhi committed Jun 15, 2021
1 parent 93b4fe1 commit 706b812
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions tardis/tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os
from astropy import units as u
from io import StringIO
from IPython import get_ipython

from tardis.util.base import (
MalformedSpeciesError,
Expand All @@ -22,6 +23,7 @@
reformat_element_symbol,
quantity_linspace,
convert_abundances_format,
check_simulation_env,
)

data_path = os.path.join("tardis", "io", "tests", "data")
Expand Down Expand Up @@ -149,11 +151,7 @@ def test_species_tuple_to_string(species_tuple, roman_numerals, species_string):

@pytest.mark.parametrize(
["species_string", "species_tuple"],
[
("si ii", (14, 1)),
("si 2", (14, 1)),
("si ix", (14, 8)),
],
[("si ii", (14, 1)), ("si 2", (14, 1)), ("si ix", (14, 8)),],
)
def test_species_string_to_tuple(species_string, species_tuple):
assert species_string_to_tuple(species_string) == species_tuple
Expand Down Expand Up @@ -202,13 +200,7 @@ def test_atomic_number2element_symbol():

@pytest.mark.parametrize(
["unformatted_element_string", "formatted_element_string"],
[
("si", "Si"),
("sI", "Si"),
("Si", "Si"),
("c", "C"),
("C", "C"),
],
[("si", "Si"), ("sI", "Si"), ("Si", "Si"), ("c", "C"), ("C", "C"),],
)
def test_reformat_element_symbol(
unformatted_element_string, formatted_element_string
Expand Down Expand Up @@ -251,3 +243,16 @@ def test_convert_abundances_format(artis_abundances_fname):
assert np.isclose(abundances.loc[1, "Co"], 2.306023e-05, atol=1.0e-12)
assert np.isclose(abundances.loc[69, "Ni"], 1.029928e-17, atol=1.0e-12)
assert np.isclose(abundances.loc[2, "C"], 4.425876e-09, atol=1.0e-12)


# @pytest.mark.parametrize(
# "test_shell_config, expected_value",
# [
# ("ZMQInteractiveShell", True),
# ("TerminalInteractiveShell", False),
# ("something", False),
# ],
# )
# def test_check_simulation_env(test_shell_config, expected_value):
def test_check_simulation_env():
assert check_simulation_env() == False

0 comments on commit 706b812

Please sign in to comment.