Skip to content

Commit ff08b0a

Browse files
committed
Dictionary numeric comparison
1 parent 4ba716c commit ff08b0a

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

tests/test_morphpy.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,14 @@ class Chain:
9191
assert np.allclose(
9292
[rw], [self.morphapp_results[target_file.name]["Rw"]]
9393
)
94-
assert morph_results == self.morphapp_results
94+
# Check values in dictionaries are approximately equal
95+
for file in morph_results.keys():
96+
morph_params = morph_results[file]
97+
morphapp_params = self.morphapp_results[file]
98+
for key in morph_params.keys():
99+
assert morph_params[key] == pytest.approx(
100+
morphapp_params[key], abs=1e-08
101+
)
95102

96103
def test_morphpy(self, setup_morph):
97104
morph_results = {}
@@ -113,7 +120,14 @@ class Chain:
113120
assert np.allclose(
114121
[rw], [self.morphapp_results[target_file.name]["Rw"]]
115122
)
116-
assert morph_results == self.morphapp_results
123+
# Check values in dictionaries are approximately equal
124+
for file in morph_results.keys():
125+
morph_params = morph_results[file]
126+
morphapp_params = self.morphapp_results[file]
127+
for key in morph_params.keys():
128+
assert morph_params[key] == pytest.approx(
129+
morphapp_params[key], abs=1e-08
130+
)
117131

118132
def test_morphfuncy(self, setup_morph):
119133
def gaussian(x, mu, sigma):

0 commit comments

Comments
 (0)