From 4050edf8dec51e940b1990909adfb400dd1a274d Mon Sep 17 00:00:00 2001 From: jrudz Date: Fri, 28 Jun 2024 13:03:49 +0200 Subject: [PATCH] ruff --- .../schema_packages/outputs.py | 2 +- .../schema_packages/physical_property.py | 2 ++ .../properties/thermodynamics.py | 1 + tests/test_energies.py | 2 ++ tests/test_forces.py | 1 + tests/test_thermodynamics.py | 23 +++++++++++++++---- 6 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/nomad_simulations/schema_packages/outputs.py b/src/nomad_simulations/schema_packages/outputs.py index 973af6c3..71cbf010 100644 --- a/src/nomad_simulations/schema_packages/outputs.py +++ b/src/nomad_simulations/schema_packages/outputs.py @@ -48,7 +48,7 @@ KineticEnergy, PotentialEnergy, TotalForce, - Temperature + Temperature, ) diff --git a/src/nomad_simulations/schema_packages/physical_property.py b/src/nomad_simulations/schema_packages/physical_property.py index 038ac820..6ef41e31 100644 --- a/src/nomad_simulations/schema_packages/physical_property.py +++ b/src/nomad_simulations/schema_packages/physical_property.py @@ -327,11 +327,13 @@ def normalize(self, archive: 'EntryArchive', logger: 'BoundLogger') -> None: # Resolve if the physical property `is_derived` or not from another physical property. self.is_derived = self._is_derived() + class PropertyContribution(PhysicalProperty): """ Abstract physical property section linking a property contribution to a contribution from some method. """ + model_method_ref = Quantity( type=ModelMethod, description=""" diff --git a/src/nomad_simulations/schema_packages/properties/thermodynamics.py b/src/nomad_simulations/schema_packages/properties/thermodynamics.py index 6200d6cb..b92dd04a 100644 --- a/src/nomad_simulations/schema_packages/properties/thermodynamics.py +++ b/src/nomad_simulations/schema_packages/properties/thermodynamics.py @@ -248,6 +248,7 @@ def normalize(self, archive, logger) -> None: super().normalize(archive, logger) +# ? I think this may fit better elsewhere class Hessian(PhysicalProperty): """ Physical property section describing the Hessian matrix, i.e., 2nd derivatives with respect to geometric (typically particle) displacements, diff --git a/tests/test_energies.py b/tests/test_energies.py index cee104c1..6dc2daeb 100644 --- a/tests/test_energies.py +++ b/tests/test_energies.py @@ -55,6 +55,7 @@ def test_default_quantities(self): assert total_energy.name == 'TotalEnergy' assert total_energy.rank == [] + class TestKineticEnergy: """ Test the `KineticEnergy` class defined in `properties/energies.py`. @@ -70,6 +71,7 @@ def test_default_quantities(self): assert kinetic_energy.name == 'KineticEnergy' assert kinetic_energy.rank == [] + class TestPotentialEnergy: """ Test the `PotentialEnergy` class defined in `properties/energies.py`. diff --git a/tests/test_forces.py b/tests/test_forces.py index 194e9740..c172bb6d 100644 --- a/tests/test_forces.py +++ b/tests/test_forces.py @@ -18,6 +18,7 @@ from nomad_simulations.schema_packages.properties import TotalForce + class TestTotalForce: """ Test the `TotalForce` class defined in `properties/forces.py`. diff --git a/tests/test_thermodynamics.py b/tests/test_thermodynamics.py index fa4b0935..01352b9b 100644 --- a/tests/test_thermodynamics.py +++ b/tests/test_thermodynamics.py @@ -34,6 +34,8 @@ Density, Hessian, ) + + class TestPressure: """ Test the `Pressure` class defined in `properties/thermodynamics.py`. @@ -49,6 +51,7 @@ def test_default_quantities(self): assert pressure.name == 'Pressure' assert pressure.rank == [] + class TestVolume: """ Test the `Volume` class defined in `properties/thermodynamics.py`. @@ -64,6 +67,7 @@ def test_default_quantities(self): assert volume.name == 'Volume' assert volume.rank == [] + class TestTemperature: """ Test the `Temperature` class defined in `properties/thermodynamics.py`. @@ -79,6 +83,7 @@ def test_default_quantities(self): assert temperature.name == 'Temperature' assert temperature.rank == [] + class TestHeatAdded: """ Test the `HeatAdded` class defined in `properties/thermodynamics.py`. @@ -94,6 +99,7 @@ def test_default_quantities(self): assert heat_added.name == 'HeatAdded' assert heat_added.rank == [] + class TestWorkDone: """ Test the `WorkDone` class defined in `properties/thermodynamics.py`. @@ -109,6 +115,7 @@ def test_default_quantities(self): assert work_done.name == 'WorkDone' assert work_done.rank == [] + class TestInternalEnergy: """ Test the `InternalEnergy` class defined in `properties/thermodynamics.py`. @@ -124,6 +131,7 @@ def test_default_quantities(self): assert internal_energy.name == 'InternalEnergy' assert internal_energy.rank == [] + class TestEnthalpy: """ Test the `Enthalpy` class defined in `properties/thermodynamics.py`. @@ -155,6 +163,7 @@ def test_default_quantities(self): assert entropy.name == 'Entropy' assert entropy.rank == [] + class TestGibbsFreeEnergy: """ Test the `GibbsFreeEnergy` class defined in `properties/thermodynamics.py`. @@ -166,10 +175,13 @@ def test_default_quantities(self): Test the default quantities assigned when creating an instance of the `GibbsFreeEnergy` class. """ gibbs_free_energy = GibbsFreeEnergy() - assert gibbs_free_energy.iri == 'http://fairmat-nfdi.eu/taxonomy/GibbsFreeEnergy' + assert ( + gibbs_free_energy.iri == 'http://fairmat-nfdi.eu/taxonomy/GibbsFreeEnergy' + ) assert gibbs_free_energy.name == 'GibbsFreeEnergy' assert gibbs_free_energy.rank == [] + class TestHelmholtzFreeEnergy: """ Test the `HelmholtzFreeEnergy` class defined in `properties/thermodynamics.py`. @@ -181,10 +193,14 @@ def test_default_quantities(self): Test the default quantities assigned when creating an instance of the `HelmholtzFreeEnergy` class. """ helmholtz_free_energy = HelmholtzFreeEnergy() - assert helmholtz_free_energy.iri == 'http://fairmat-nfdi.eu/taxonomy/HelmholtzFreeEnergy' + assert ( + helmholtz_free_energy.iri + == 'http://fairmat-nfdi.eu/taxonomy/HelmholtzFreeEnergy' + ) assert helmholtz_free_energy.name == 'HelmholtzFreeEnergy' assert helmholtz_free_energy.rank == [] + class TestChemicalPotential: """ Test the `ChemicalPotential` class defined in `properties/thermodynamics.py`. @@ -235,6 +251,7 @@ def test_default_quantities(self): assert heat_capacity_cp.name == 'HeatCapacityCP' assert heat_capacity_cp.rank == [] + class TestVirial: """ Test the `Virial` class defined in `properties/thermodynamics.py`. @@ -281,5 +298,3 @@ def test_default_quantities(self): assert hessian.iri == 'http://fairmat-nfdi.eu/taxonomy/Hessian' assert hessian.name == 'Hessian' assert hessian.rank == [] - -