Skip to content

Commit

Permalink
change assertion format
Browse files Browse the repository at this point in the history
  • Loading branch information
htz1992213 committed Feb 5, 2024
1 parent 5da174a commit e7929de
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions tests/test_volume.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import unittest

from numpy.testing import assert_allclose
from pymatgen.core import Molecule

from mdgo.util.volume import molecular_volume
Expand All @@ -27,37 +28,37 @@ def test_molecular_volume(self) -> None:
lipf6_volume_3 = molecular_volume(self.lipf6, radii_type="Lange")
lipf6_volume_4 = molecular_volume(self.lipf6, radii_type="pymatgen")
lipf6_volume_5 = molecular_volume(self.lipf6, molar_volume=False)
assert lipf6_volume_1 == 47.62
assert lipf6_volume_2 == 43.36
assert lipf6_volume_3 == 41.49
assert lipf6_volume_4 == 51.94
assert lipf6_volume_5 == 79.08
assert_allclose(lipf6_volume_1, 47.62)
assert_allclose(lipf6_volume_2, 43.36)
assert_allclose(lipf6_volume_3, 41.49)
assert_allclose(lipf6_volume_4, 51.94)
assert_allclose(lipf6_volume_5, 79.08)
ec_volume_1 = molecular_volume(self.ec)
ec_volume_2 = molecular_volume(self.ec, exclude_h=False)
ec_volume_3 = molecular_volume(self.ec, res=1.0)
ec_volume_4 = molecular_volume(self.ec, radii_type="Lange")
ec_volume_5 = molecular_volume(self.ec, radii_type="pymatgen")
ec_volume_6 = molecular_volume(self.ec, molar_volume=False)
assert ec_volume_1 == 38.44
assert ec_volume_2 == 43.17
assert ec_volume_3 == 40.95
assert ec_volume_4 == 41.07
assert ec_volume_5 == 38.44
assert ec_volume_6 == 63.83
assert_allclose(ec_volume_1, 38.44)
assert_allclose(ec_volume_2, 43.17)
assert_allclose(ec_volume_3, 40.95)
assert_allclose(ec_volume_4, 41.07)
assert_allclose(ec_volume_5, 38.44)
assert_allclose(ec_volume_6, 63.83)
litfsi_volume_1 = molecular_volume(self.litfsi)
litfsi_volume_2 = molecular_volume(self.litfsi, exclude_h=False)
litfsi_volume_3 = molecular_volume(self.litfsi, res=1.0)
litfsi_volume_4 = molecular_volume(self.litfsi, radii_type="Lange")
litfsi_volume_5 = molecular_volume(self.litfsi, radii_type="pymatgen")
litfsi_volume_6 = molecular_volume(self.litfsi, molar_volume=False)
litfsi_volume_7 = molecular_volume(self.litfsi, mode="act", x_size=8, y_size=8, z_size=8)
assert litfsi_volume_1 == 100.16
assert litfsi_volume_2 == 100.16
assert litfsi_volume_3 == 99.37
assert litfsi_volume_4 == 90.78
assert litfsi_volume_5 == 105.31
assert litfsi_volume_6 == 166.32
assert litfsi_volume_7 == 124.66
assert_allclose(litfsi_volume_1, 100.16)
assert_allclose(litfsi_volume_2, 100.16)
assert_allclose(litfsi_volume_3, 99.37)
assert_allclose(litfsi_volume_4, 90.78)
assert_allclose(litfsi_volume_5, 105.31)
assert_allclose(litfsi_volume_6, 166.32)
assert_allclose(litfsi_volume_7, 124.66)


if __name__ == "__main__":
Expand Down

0 comments on commit e7929de

Please sign in to comment.