From f2b9bd2908f88495cffd73b88b78abff6a21e674 Mon Sep 17 00:00:00 2001 From: JosePizarro3 Date: Wed, 22 May 2024 13:47:09 +0200 Subject: [PATCH] Fix testing when changing to plural the properties --- tests/conftest.py | 6 +++--- tests/test_outputs.py | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 39107094..2f62bb31 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -170,16 +170,16 @@ def generate_scf_electronic_band_gap_template( for i in range(1, n_scf_steps): value = 1 + sum([1 / (10**j) for j in range(1, i + 1)]) scf_step = Outputs( - electronic_band_gap=[ElectronicBandGap(value=value * ureg.joule)] + electronic_band_gaps=[ElectronicBandGap(value=value * ureg.joule)] ) scf_outputs.scf_steps.append(scf_step) # Add a SCF calculated PhysicalProperty - scf_outputs.electronic_band_gap.append(ElectronicBandGap(value=value * ureg.joule)) + scf_outputs.electronic_band_gaps.append(ElectronicBandGap(value=value * ureg.joule)) # and a `SelfConsistency` ref section scf_params = SelfConsistency( threshold_change=threshold_change, threshold_change_unit='joule' ) - scf_outputs.electronic_band_gap[0].self_consistency_ref = scf_params + scf_outputs.electronic_band_gaps[0].self_consistency_ref = scf_params return scf_outputs diff --git a/tests/test_outputs.py b/tests/test_outputs.py index aac05ced..d4efaaa2 100644 --- a/tests/test_outputs.py +++ b/tests/test_outputs.py @@ -44,9 +44,9 @@ def test_is_scf_converged(self, threshold_change: float, result: bool): threshold_change=threshold_change ) is_scf_converged = scf_outputs.resolve_is_scf_converged( - property_name='electronic_band_gap', + property_name='electronic_band_gaps', i_property=0, - phys_property=scf_outputs.electronic_band_gap[0], + phys_property=scf_outputs.electronic_band_gaps[0], logger=logger, ) assert is_scf_converged == result @@ -60,18 +60,18 @@ def test_extract_spin_polarized_properties(self): # No spin-polarized band gap band_gap_non_spin_polarized = ElectronicBandGap(variables=[]) band_gap_non_spin_polarized.value = 2.0 * ureg.joule - outputs.electronic_band_gap.append(band_gap_non_spin_polarized) - band_gaps = outputs.extract_spin_polarized_property('electronic_band_gap') + outputs.electronic_band_gaps.append(band_gap_non_spin_polarized) + band_gaps = outputs.extract_spin_polarized_property('electronic_band_gaps') assert band_gaps == [] # Spin-polarized band gaps band_gap_spin_1 = ElectronicBandGap(variables=[], spin_channel=0) band_gap_spin_1.value = 1.0 * ureg.joule - outputs.electronic_band_gap.append(band_gap_spin_1) + outputs.electronic_band_gaps.append(band_gap_spin_1) band_gap_spin_2 = ElectronicBandGap(variables=[], spin_channel=1) band_gap_spin_2.value = 1.5 * ureg.joule - outputs.electronic_band_gap.append(band_gap_spin_2) - band_gaps = outputs.extract_spin_polarized_property('electronic_band_gap') + outputs.electronic_band_gaps.append(band_gap_spin_2) + band_gaps = outputs.extract_spin_polarized_property('electronic_band_gaps') assert len(band_gaps) == 2 assert band_gaps[0].value.magnitude == 1.0 assert band_gaps[1].value.magnitude == 1.5 @@ -89,4 +89,4 @@ def test_normalize(self, threshold_change: float, result: bool): ) scf_outputs.normalize(EntryArchive(), logger) - assert scf_outputs.electronic_band_gap[0].is_scf_converged == result + assert scf_outputs.electronic_band_gaps[0].is_scf_converged == result