Skip to content

Commit a374692

Browse files
committed
test for the addition of a header to results
1 parent 96025a0 commit a374692

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

tests/test_fitresults.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
# The fit results from the recipe fixture in conftest.py
2626
expected_fitresults = """\
27+
My Custom header
2728
Some quantities invalid due to missing profile uncertainty
2829
Overall (Chi2 and Reduced Chi2 invalid)
2930
------------------------------------------------------------------------------
@@ -51,7 +52,7 @@ def test_formatResults(build_recipe_one_contribution):
5152
recipe = build_recipe_one_contribution
5253
optimize_recipe(recipe)
5354
results = FitResults(recipe)
54-
actual_results_string = results.formatResults()
55+
actual_results_string = results.formatResults(header="My Custom header")
5556
# Because slight variations in refinement, just check
5657
# that the header of the results are the same.
5758
assert expected_fitresults.strip() in actual_results_string.strip()
@@ -64,7 +65,9 @@ def test_get_results_string(build_recipe_one_contribution):
6465
recipe = build_recipe_one_contribution
6566
optimize_recipe(recipe)
6667
results = FitResults(recipe)
67-
actual_results_string = results.get_results_string()
68+
actual_results_string = results.get_results_string(
69+
header="My Custom header"
70+
)
6871
# Because slight variations in refinement, just check
6972
# that the header of the results are the same.
7073
assert expected_fitresults.strip() in actual_results_string.strip()
@@ -77,7 +80,7 @@ def test_printResults(build_recipe_one_contribution, capsys):
7780
recipe = build_recipe_one_contribution
7881
optimize_recipe(recipe)
7982
results = FitResults(recipe)
80-
results.printResults()
83+
results.printResults(header="My Custom header")
8184
actual_results = capsys.readouterr().out
8285
# Because slight variations in refinement, just check
8386
# that the header of the results are the same.
@@ -91,7 +94,7 @@ def test_print_results(build_recipe_one_contribution, capsys):
9194
recipe = build_recipe_one_contribution
9295
optimize_recipe(recipe)
9396
results = FitResults(recipe)
94-
results.print_results()
97+
results.print_results(header="My Custom header")
9598
actual_results = capsys.readouterr().out
9699
# Because slight variations in refinement, just check
97100
# that the header of the results are the same.
@@ -106,7 +109,7 @@ def test_saveResults(build_recipe_one_contribution, tmp_path):
106109
optimize_recipe(recipe)
107110
results = FitResults(recipe)
108111
actual_results_file = tmp_path / "fit_results.txt"
109-
results.saveResults(actual_results_file)
112+
results.saveResults(actual_results_file, header="My Custom header")
110113
assert actual_results_file.exists()
111114
with open(actual_results_file, "r") as res_file:
112115
actual_results = res_file.read()

0 commit comments

Comments
 (0)