[scripts] update handling of expected results in tests

parent 4d51fb00
......@@ -17,15 +17,25 @@ pou_id = 'FtPoU1Overlap'
def test_fixed_H_refined_h_same_as_Q1():
results = run_fixed_H_refined_h((1, 2), make_pou, pou_id)
expected_results = expected_results_fixed_H_refined_h()
errors = {}
for kk, vv in expected_results.items():
assert np.allclose(results[kk], vv)
if not np.allclose(results[kk], vv):
errors[kk] = {}
errors[kk]['expected'] = vv
errors[kk]['actual'] = results[kk]
assert len(errors) == 0, errors
def test_fixed_h_refined_H_same_as_Q1():
results = run_fixed_h_refined_H(2, make_pou, pou_id)
expected_results = expected_results_fixed_h_refined_H()
errors = {}
for kk, vv in expected_results.items():
assert np.allclose(results[kk], vv)
if not np.allclose(results[kk], vv):
errors[kk] = {}
errors[kk]['expected'] = vv
errors[kk]['actual'] = results[kk]
assert len(errors) == 0, errors
if __name__ == '__main__':
......
......@@ -149,15 +149,25 @@ def expected_results_fixed_h_refined_H():
def test_fixed_H_refined_h():
results = run_fixed_H_refined_h(num_refs=(1, 2))
expected_results = expected_results_fixed_H_refined_h()
errors = {}
for kk, vv in expected_results.items():
assert np.allclose(results[kk], vv)
if not np.allclose(results[kk], vv):
errors[kk] = {}
errors[kk]['expected'] = vv
errors[kk]['actual'] = results[kk]
assert len(errors) == 0, errors
def test_fixed_h_refined_H():
results = run_fixed_h_refined_H(num_H_refs=2)
expected_results = expected_results_fixed_h_refined_H()
errors = {}
for kk, vv in expected_results.items():
assert np.allclose(results[kk], vv)
if not np.allclose(results[kk], vv):
errors[kk] = {}
errors[kk]['expected'] = vv
errors[kk]['actual'] = results[kk]
assert len(errors) == 0, errors
if __name__ == '__main__':
......
......@@ -77,8 +77,13 @@ def test():
'FT_estimate_1.0': 95.19151045525781,
}
import numpy as np
errors = {}
for kk, vv in expected_results.items():
assert np.allclose(results[kk], vv)
if not np.allclose(results[kk], vv):
errors[kk] = {}
errors[kk]['expected'] = vv
errors[kk]['actual'] = results[kk]
assert len(errors) == 0, errors
if __name__ == '__main__':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment