Skip to content

Commit

Permalink
ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
jrudz committed Jun 28, 2024
1 parent b567172 commit 4050edf
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/nomad_simulations/schema_packages/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
KineticEnergy,
PotentialEnergy,
TotalForce,
Temperature
Temperature,
)


Expand Down
2 changes: 2 additions & 0 deletions src/nomad_simulations/schema_packages/physical_property.py
Original file line number Diff line number Diff line change
Expand Up @@ -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="""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions tests/test_energies.py
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand All @@ -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`.
Expand Down
1 change: 1 addition & 0 deletions tests/test_forces.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

from nomad_simulations.schema_packages.properties import TotalForce


class TestTotalForce:
"""
Test the `TotalForce` class defined in `properties/forces.py`.
Expand Down
23 changes: 19 additions & 4 deletions tests/test_thermodynamics.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
Density,
Hessian,
)


class TestPressure:
"""
Test the `Pressure` class defined in `properties/thermodynamics.py`.
Expand All @@ -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`.
Expand All @@ -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`.
Expand All @@ -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`.
Expand All @@ -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`.
Expand All @@ -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`.
Expand All @@ -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`.
Expand Down Expand Up @@ -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`.
Expand All @@ -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`.
Expand All @@ -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`.
Expand Down Expand Up @@ -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`.
Expand Down Expand Up @@ -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 == []


0 comments on commit 4050edf

Please sign in to comment.