Skip to content

Commit d59197b

Browse files
committed
Ensure both atol and rtol values are tested
1 parent a74f2e3 commit d59197b

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed
5.63 KB
Binary file not shown.

tests/test_pytest_arraydiff.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,20 @@ def test_default_format(file_format):
132132
assert os.path.exists(os.path.join(gen_dir, 'test_default.' + ('fits' if file_format == 'fits' else 'txt')))
133133

134134

135-
@pytest.mark.array_compare(reference_dir=reference_dir, rtol=0.5, file_format='fits')
136-
def test_tolerance():
137-
return np.ones((3, 4)) * 1.6
135+
@pytest.mark.array_compare(reference_dir=reference_dir, rtol=0.5,
136+
file_format='fits')
137+
def test_relative_tolerance():
138+
# Scale up the output values by 1.5 to ensure the large `rtol` value is
139+
# needed. (The comparison file contains all 1.6.)
140+
return np.ones((3, 4)) * 1.6 * 1.5
141+
142+
143+
@pytest.mark.array_compare(reference_dir=reference_dir, atol=1.5,
144+
file_format='fits')
145+
def test_absolute_tolerance():
146+
# Increase the output values by 1.4 to ensure the large `atol` value is
147+
# needed. (The comparison file contains all 1.6.)
148+
return np.ones((3, 4)) * 1.6 + 1.4
138149

139150

140151
def test_nofile():

0 commit comments

Comments
 (0)