Skip to content

Commit ecca8c5

Browse files
committed
Tests: Lower the accuracy of get_zmat_param_value almost equal checks
To avoid errors like: AssertionError: 160.00001525878906 != 160 within 5 places (1.52587890625e-05 difference)
1 parent af60235 commit ecca8c5

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

arc/species/converter_test.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4003,7 +4003,7 @@ def test_modify_coords(self):
40034003
new_xyz = converter.modify_coords(coords=xyz1, indices=indices, new_value=new_val,
40044004
modification_type=modification_type, mol=mol1)
40054005
self.assertTrue(almost_equal_coords_lists(new_xyz, expected_xyz))
4006-
self.assertAlmostEqual(converter.get_zmat_param_value(coords=new_xyz, indices=indices, mol=mol1), new_val, 5)
4006+
self.assertAlmostEqual(converter.get_zmat_param_value(coords=new_xyz, indices=indices, mol=mol1), new_val, 3)
40074007

40084008
indices, new_val = [1, 0], -1.5
40094009
expected_xyz = {'symbols': ('O', 'C', 'C', 'O', 'H', 'H', 'H', 'H'), 'isotopes': (16, 12, 12, 16, 1, 1, 1, 1),
@@ -4034,7 +4034,7 @@ def test_modify_coords(self):
40344034
new_xyz = converter.modify_coords(coords=xyz1, indices=indices, new_value=new_val,
40354035
modification_type=modification_type, mol=mol1)
40364036
self.assertTrue(almost_equal_coords_lists(new_xyz, expected_xyz))
4037-
self.assertAlmostEqual(converter.get_zmat_param_value(coords=new_xyz, indices=indices, mol=mol1), new_val, 5)
4037+
self.assertAlmostEqual(converter.get_zmat_param_value(coords=new_xyz, indices=indices, mol=mol1), new_val, 3)
40384038

40394039
# test changing an angle to 180 degrees
40404040
indices, new_val = [0, 1, 2], 180
@@ -4080,7 +4080,7 @@ def test_modify_coords(self):
40804080
new_xyz = converter.modify_coords(coords=xyz1, indices=indices, new_value=new_val,
40814081
modification_type=modification_type, mol=mol1)
40824082
self.assertTrue(almost_equal_coords_lists(new_xyz, expected_xyz))
4083-
self.assertAlmostEqual(converter.get_zmat_param_value(coords=new_xyz, indices=indices, mol=mol1), new_val, 5)
4083+
self.assertAlmostEqual(converter.get_zmat_param_value(coords=new_xyz, indices=indices, mol=mol1), new_val, 3)
40844084

40854085
indices, new_val = [3, 2, 1, 0], -30
40864086
expected_xyz = {'symbols': ('O', 'C', 'C', 'O', 'H', 'H', 'H', 'H'), 'isotopes': (16, 12, 12, 16, 1, 1, 1, 1),
@@ -4131,7 +4131,7 @@ def test_modify_coords(self):
41314131
new_xyz = converter.modify_coords(coords=xyz1, indices=indices, new_value=new_val,
41324132
modification_type=modification_type, mol=mol1)
41334133
self.assertTrue(almost_equal_coords_lists(new_xyz, expected_xyz))
4134-
self.assertAlmostEqual(converter.get_zmat_param_value(coords=new_xyz, indices=indices, mol=mol1), new_val, 5)
4134+
self.assertAlmostEqual(converter.get_zmat_param_value(coords=new_xyz, indices=indices, mol=mol1), new_val, 3)
41354135

41364136
# test A_group modification
41374137
indices, new_val = [0, 1, 2], 160
@@ -4147,7 +4147,7 @@ def test_modify_coords(self):
41474147
new_xyz = converter.modify_coords(coords=xyz1, indices=indices, new_value=new_val,
41484148
modification_type=modification_type, mol=mol1)
41494149
self.assertTrue(almost_equal_coords_lists(new_xyz, expected_xyz))
4150-
self.assertAlmostEqual(converter.get_zmat_param_value(coords=new_xyz, indices=indices, mol=mol1), new_val, 5)
4150+
self.assertAlmostEqual(converter.get_zmat_param_value(coords=new_xyz, indices=indices, mol=mol1), new_val, 3)
41514151

41524152
indices, new_val = [1, 2, 5], 160
41534153
expected_xyz = {'symbols': ('O', 'C', 'C', 'S', 'O', 'C', 'C', 'H', 'H', 'H', 'H', 'H', 'H', 'H', 'H', 'H'),
@@ -4211,7 +4211,7 @@ def test_modify_coords(self):
42114211
new_xyz = converter.modify_coords(coords=xyz1, indices=indices, new_value=new_val,
42124212
modification_type=modification_type, mol=mol1)
42134213
self.assertTrue(almost_equal_coords_lists(new_xyz, expected_xyz))
4214-
self.assertAlmostEqual(converter.get_zmat_param_value(coords=new_xyz, indices=indices, mol=mol1), new_val, 5)
4214+
self.assertAlmostEqual(converter.get_zmat_param_value(coords=new_xyz, indices=indices, mol=mol1), new_val, 3)
42154215

42164216
indices, new_val = [5, 2, 1, 0], 180
42174217
expected_xyz = {'symbols': ('O', 'C', 'C', 'S', 'O', 'C', 'C', 'H', 'H', 'H', 'H', 'H', 'H', 'H', 'H', 'H'),
@@ -4278,7 +4278,7 @@ def test_modify_coords(self):
42784278
new_xyz = converter.modify_coords(coords=xyz1, indices=indices, new_value=new_val,
42794279
modification_type=modification_type, mol=mol1)
42804280
self.assertTrue(almost_equal_coords_lists(new_xyz, expected_xyz))
4281-
self.assertAlmostEqual(converter.get_zmat_param_value(coords=new_xyz, indices=indices, mol=mol1), new_val, 4)
4281+
self.assertAlmostEqual(converter.get_zmat_param_value(coords=new_xyz, indices=indices, mol=mol1), new_val, 3)
42824282
self.assertAlmostEqual(converter.get_zmat_param_value(coords=xyz1, indices=[4, 1, 2, 3], mol=mol1),
42834283
176.7937925, 4)
42844284
self.assertAlmostEqual(converter.get_zmat_param_value(coords=new_xyz, indices=[4, 1, 2, 3], mol=mol1),

0 commit comments

Comments
 (0)