Skip to content

Commit

Permalink
@pytest.fixture -> @pytest.fixture()
Browse files Browse the repository at this point in the history
  • Loading branch information
Sonu0305 committed Jan 15, 2025
1 parent 0cc6255 commit 6316bd8
Show file tree
Hide file tree
Showing 17 changed files with 57 additions and 57 deletions.
8 changes: 4 additions & 4 deletions tardis/io/model/readers/tests/test_arepo_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def arepo_snapshot_fname(tardis_regression_path):
return Path(tardis_regression_path) / "arepo_data" / "arepo_snapshot.json"


@pytest.fixture
@pytest.fixture()
def get_cone_csvy_model(arepo_snapshot_fname, example_model_file_dir):
with open(arepo_snapshot_fname) as json_file:
data = json.loads(json.load(json_file))
Expand Down Expand Up @@ -56,7 +56,7 @@ def get_cone_csvy_model(arepo_snapshot_fname, example_model_file_dir):
return data


@pytest.fixture
@pytest.fixture()
def get_full_csvy_model(arepo_snapshot_fname, example_model_file_dir):
with open(arepo_snapshot_fname) as json_file:
data = json.loads(json.load(json_file))
Expand Down Expand Up @@ -96,7 +96,7 @@ def get_full_csvy_model(arepo_snapshot_fname, example_model_file_dir):
return data


@pytest.fixture
@pytest.fixture()
def get_cone_reference_data(example_model_file_dir):
with open(
example_model_file_dir / "arepo_cone_reference_model.csvy"
Expand All @@ -106,7 +106,7 @@ def get_cone_reference_data(example_model_file_dir):
return data


@pytest.fixture
@pytest.fixture()
def get_full_reference_data(example_model_file_dir):
with open(
example_model_file_dir / "arepo_full_reference_model.csvy"
Expand Down
2 changes: 1 addition & 1 deletion tardis/io/model/readers/tests/test_cmfgen_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
MODEL_DATA_PATH = Path(__file__).parent / "data"


@fixture
@fixture()
def cmfgen_model_example_file():
return read_cmfgen_model(MODEL_DATA_PATH / "cmfgen_model.csv")

Expand Down
6 changes: 3 additions & 3 deletions tardis/io/model/readers/tests/test_csvy_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
from tardis.io.model.readers import csvy


@pytest.fixture
@pytest.fixture()
def csvy_full_fname(example_model_file_dir: Path):
return example_model_file_dir / "csvy_full.csvy"


@pytest.fixture
@pytest.fixture()
def csvy_nocsv_fname(example_model_file_dir: Path):
return example_model_file_dir / "csvy_nocsv.csvy"


@pytest.fixture
@pytest.fixture()
def csvy_missing_fname(example_model_file_dir: Path):
return example_model_file_dir / "csvy_missing.csvy"

Expand Down
2 changes: 1 addition & 1 deletion tardis/io/model/readers/tests/test_stella_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
MODEL_DATA_PATH = Path(__file__).parent / "data"


@fixture
@fixture()
def stella_model_example_file1():
return read_stella_model(MODEL_DATA_PATH / "mesa.stella.dat")

Expand Down
8 changes: 4 additions & 4 deletions tardis/io/tests/test_atomic.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@
from tardis import constants as const


@pytest.fixture
@pytest.fixture()
def basic_atom_data(kurucz_atomic_data):
return kurucz_atomic_data.atom_data


@pytest.fixture
@pytest.fixture()
def ionization_data(kurucz_atomic_data):
return kurucz_atomic_data.ionization_data


@pytest.fixture
@pytest.fixture()
def levels(kurucz_atomic_data):
return kurucz_atomic_data.levels


@pytest.fixture
@pytest.fixture()
def lines(kurucz_atomic_data):
return kurucz_atomic_data.lines

Expand Down
4 changes: 2 additions & 2 deletions tardis/io/tests/test_decay.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from tardis.model.matter.decay import IsotopicMassFraction


@pytest.fixture
@pytest.fixture()
def simple_abundance_model():
index = pd.MultiIndex.from_tuples(
[(28, 56)], names=["atomic_number", "mass_number"]
Expand All @@ -23,7 +23,7 @@ def test_simple_decay(simple_abundance_model):
assert_almost_equal(decayed_abundance.loc[28, 56][1], 1.10859709e-05)


@pytest.fixture
@pytest.fixture()
def raw_abundance_simple():
abundances = pd.DataFrame([[0.2, 0.2], [0.1, 0.1]], index=[28, 30])
abundances.index = abundances.index.rename("atomic_number")
Expand Down
10 changes: 5 additions & 5 deletions tardis/io/tests/test_model_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,27 @@
)


@pytest.fixture
@pytest.fixture()
def artis_density_fname(example_model_file_dir):
return example_model_file_dir / "artis_model.dat"


@pytest.fixture
@pytest.fixture()
def artis_abundances_fname(example_model_file_dir):
return example_model_file_dir / "artis_abundances.dat"


@pytest.fixture
@pytest.fixture()
def cmfgen_fname(example_model_file_dir):
return example_model_file_dir / "cmfgen_model.csv"


@pytest.fixture
@pytest.fixture()
def csv_composition_fname(example_model_file_dir):
return example_model_file_dir / "csv_composition.csv"


@pytest.fixture
@pytest.fixture()
def isotope_uniform_abundance(example_model_file_dir):
config_path = (
example_model_file_dir / "tardis_configv1_isotope_uniabund.yml"
Expand Down
6 changes: 3 additions & 3 deletions tardis/model/tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ def test_ascii_reader_exponential_law(
assert simulation_state.density[i].unit == u.Unit(expected_unit)


@pytest.fixture
@pytest.fixture()
def simple_isotope_abundance():
index = pd.MultiIndex.from_tuples(
[(6, 14), (12, 28)], names=["atomic_number", "mass_number"]
Expand Down Expand Up @@ -398,7 +398,7 @@ def test_simulation_state_mass(simulation_verysimple, index, expected):
assert_almost_equal(elemental_cell_masses.loc[index], expected, decimal=-27)


@pytest.fixture
@pytest.fixture()
def non_uniform_simulation_state(atomic_dataset, example_model_file_dir):
config = Configuration.from_yaml(
example_model_file_dir / "tardis_configv1_isotope_iabund.yml"
Expand Down Expand Up @@ -430,7 +430,7 @@ def test_radial_1d_model_atomic_mass(


class TestModelStateFromNonUniformAbundances:
@pytest.fixture
@pytest.fixture()
def simulation_state(self, example_model_file_dir, atomic_dataset):
config = Configuration.from_yaml(
example_model_file_dir / "tardis_configv1_isotope_iabund.yml"
Expand Down
8 changes: 4 additions & 4 deletions tardis/plasma/equilibrium/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
)


@pytest.fixture
@pytest.fixture()
def new_chianti_atomic_dataset_si(tardis_regression_path):
atomic_data_fname = (
tardis_regression_path / "atom_data" / "kurucz_cd23_chianti_Si.h5"
Expand All @@ -24,7 +24,7 @@ def radiative_transitions(new_chianti_atomic_dataset_si, request):
return new_chianti_atomic_dataset_si.lines.loc[request.param, :]


@pytest.fixture
@pytest.fixture()
def radiative_rate_solver(radiative_transitions):
return RadiativeRatesSolver(radiative_transitions)

Expand All @@ -48,15 +48,15 @@ def collisional_rate_solver(
)


@pytest.fixture
@pytest.fixture()
def rate_solver_list(radiative_rate_solver, collisional_rate_solver):
return [
(radiative_rate_solver, "radiative"),
(collisional_rate_solver, "electron"),
]


@pytest.fixture
@pytest.fixture()
def collisional_simulation_state(new_chianti_atomic_dataset_si):
config = Configuration.from_yaml(
Path("tardis")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from tardis.plasma.radiation_field import planck_rad_field


@pytest.fixture
@pytest.fixture()
def legacy_cmfgen_collision_rate_plasma_solver(nlte_atomic_dataset):
atom_data = copy.deepcopy(nlte_atomic_dataset)
# almost all settings are irrelevant for collisional strength data
Expand Down Expand Up @@ -67,15 +67,15 @@ def legacy_cmfgen_collision_rate_plasma_solver(nlte_atomic_dataset):
)


@pytest.fixture
@pytest.fixture()
def new_chianti_atomic_dataset(tardis_regression_path):
atomic_data_fname = (
tardis_regression_path / "atom_data" / "new_kurucz_cd23_chianti_H_He.h5"
)
return AtomData.from_hdf(atomic_data_fname)


@pytest.fixture
@pytest.fixture()
def legacy_chianti_collision_rate_plasma_solver(atomic_dataset):
atom_data = copy.deepcopy(atomic_dataset)
atom_data.prepare_atom_data([1], "macroatom", [(1, 0)], [])
Expand Down
26 changes: 13 additions & 13 deletions tardis/plasma/tests/test_nlte_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
)


@pytest.fixture
@pytest.fixture()
def simple_index_nlte_ion():
"""Simple fixture for nlte_ion treatment for H I and He II.
Expand All @@ -29,7 +29,7 @@ def simple_index_nlte_ion():
)


@pytest.fixture
@pytest.fixture()
def simple_index_lte_ion():
"""Simple fixture for lte_ion treatment for H II and He I and He III.
Expand All @@ -43,7 +43,7 @@ def simple_index_lte_ion():
)


@pytest.fixture
@pytest.fixture()
def simple_rate_matrix_index():
"""Simple rate_matrix_index for NTLE ionization treatment of H I and He II.
Expand All @@ -65,7 +65,7 @@ def simple_rate_matrix_index():
)


@pytest.fixture
@pytest.fixture()
def simple_total_photo_ion_coefficients(simple_index_nlte_ion):
"""Simple coefficients for photoionization of H I and He II.
Expand All @@ -80,7 +80,7 @@ def simple_total_photo_ion_coefficients(simple_index_nlte_ion):
)


@pytest.fixture
@pytest.fixture()
def simple_total_rad_recomb_coefficients(simple_index_nlte_ion):
"""Simple coefficients for radiative recombination of H I and He II.
Expand All @@ -95,7 +95,7 @@ def simple_total_rad_recomb_coefficients(simple_index_nlte_ion):
)


@pytest.fixture
@pytest.fixture()
def simple_total_col_ion_coefficients(simple_index_nlte_ion):
"""Simple coefficients for collisional ionization of H I and He II.
Expand All @@ -110,7 +110,7 @@ def simple_total_col_ion_coefficients(simple_index_nlte_ion):
)


@pytest.fixture
@pytest.fixture()
def simple_total_col_recomb_coefficients(simple_index_nlte_ion):
"""Simple coefficients for collisional recombination of H I and He II.
Expand All @@ -125,14 +125,14 @@ def simple_total_col_recomb_coefficients(simple_index_nlte_ion):
)


@pytest.fixture
@pytest.fixture()
def simple_phi(simple_index_lte_ion):
"""Simple Saha factors for H II, He I and He III."""
simple_phi = [0.18936306, 0.15726292, 0.79851244]
return pd.DataFrame(simple_phi, index=simple_index_lte_ion)


@pytest.fixture
@pytest.fixture()
def simple_electron_density():
"""Simple electron density."""
return 0.2219604493076
Expand Down Expand Up @@ -220,7 +220,7 @@ def test_jacobian_matrix(
npt.assert_allclose(actual_jacobian_matrix, expected_jacobian_matrix)


@pytest.fixture
@pytest.fixture()
def nlte_raw_plasma_dilution_factor_1_root(
tardis_model_config_nlte_root, nlte_raw_model_root, nlte_atom_data
):
Expand All @@ -235,7 +235,7 @@ def nlte_raw_plasma_dilution_factor_1_root(
return plasma


@pytest.fixture
@pytest.fixture()
def nlte_raw_plasma_dilution_factor_1_lu(
tardis_model_config_nlte_lu, nlte_raw_model_lu, nlte_atom_data
):
Expand All @@ -250,7 +250,7 @@ def nlte_raw_plasma_dilution_factor_1_lu(
return plasma


@pytest.fixture
@pytest.fixture()
def nlte_raw_plasma_dilution_factor_0_root(
tardis_model_config_nlte_root, nlte_raw_model_root, nlte_atom_data
):
Expand All @@ -265,7 +265,7 @@ def nlte_raw_plasma_dilution_factor_0_root(
return plasma


@pytest.fixture
@pytest.fixture()
def nlte_raw_plasma_dilution_factor_0_lu(
tardis_model_config_nlte_lu, nlte_raw_model_lu, nlte_atom_data
):
Expand Down
2 changes: 1 addition & 1 deletion tardis/plasma/tests/test_plasma_vboundary.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
DATA_PATH = os.path.join(tardis.__path__[0], "plasma", "tests", "data")


@pytest.fixture
@pytest.fixture()
def config_init_trad_fname():
return os.path.join(DATA_PATH, "config_init_trad.yml")

Expand Down
2 changes: 1 addition & 1 deletion tardis/plasma/tests/test_tardis_model_density_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from tardis.plasma.assembly.legacy_assembly import assemble_plasma


@pytest.fixture
@pytest.fixture()
def tardis_model_density_config(example_model_file_dir):
return Configuration.from_yaml(
example_model_file_dir / "tardis_configv1_tardis_model_format.yml"
Expand Down
Loading

0 comments on commit 6316bd8

Please sign in to comment.