Skip to content

Commit f002ba8

Browse files
committed
Use math.isnan to make assertion explicit. [ci skip]
1 parent 80b6c98 commit f002ba8

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

tests/convert/test_openmm_water.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import math
2+
13
import pytest
24
import sire as sr
35

@@ -81,7 +83,7 @@ def test_tip3p_no_virtual_sites(tip3p_mols, openmm_platform):
8183
assert bad_constraints == 0
8284

8385
e = _potential_energy(omm)
84-
assert e == e, "Potential energy is NaN"
86+
assert not math.isnan(e), "Potential energy is NaN"
8587

8688

8789
@_skip_no_openmm
@@ -118,7 +120,7 @@ def test_tip4p_virtual_sites(tip4p_mols, openmm_platform):
118120
), f"Particle {i}: expected ThreeParticleAverageSite, got {type(vs).__name__}"
119121

120122
e = _potential_energy(omm)
121-
assert e == e, "Potential energy is NaN"
123+
assert not math.isnan(e), "Potential energy is NaN"
122124

123125

124126
@_skip_no_openmm
@@ -154,7 +156,7 @@ def test_opc_virtual_sites(opc_mols, openmm_platform):
154156
), f"Particle {i}: expected ThreeParticleAverageSite, got {type(vs).__name__}"
155157

156158
e = _potential_energy(omm)
157-
assert e == e, "Potential energy is NaN"
159+
assert not math.isnan(e), "Potential energy is NaN"
158160

159161

160162
@_skip_no_openmm
@@ -192,4 +194,4 @@ def test_tip5p_virtual_sites(tip5p_mols, openmm_platform):
192194
), f"Particle {i}: expected OutOfPlaneSite, got {type(vs).__name__}"
193195

194196
e = _potential_energy(omm)
195-
assert e == e, "Potential energy is NaN"
197+
assert not math.isnan(e), "Potential energy is NaN"

0 commit comments

Comments
 (0)