Skip to content

Commit

Permalink
Make test easier to understand
Browse files Browse the repository at this point in the history
  • Loading branch information
dafeda committed Sep 2, 2024
1 parent 3b4cd78 commit 536dc28
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions tests/unit_tests/gui/test_csv_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,29 @@ def run_experiment_via_gui(gui, qtbot):
def test_that_export_tool_does_not_produce_duplicate_data(
ensemble_experiment_has_run_no_failure, qtbot
):
"""
Ensures the export tool does not produce duplicate data by comparing
the first and second halves of the exported CSV.
This test addresses a previous issue where running two experiments with
ensembles of the same name caused duplicated data in the export. The code
has been fixed to prevent this, ensuring unique data even with identical
ensemble names across different experiments.
"""
gui = ensemble_experiment_has_run_no_failure

run_experiment_via_gui(gui, qtbot)

file_name = export_data(gui, qtbot, "*")

df = pd.read_csv(file_name)
# Make sure data is not duplicated.
assert df.iloc[0]["COEFFS:a"] != df.iloc[20]["COEFFS:a"]

# Split the dataframe into two halves
half_point = len(df) // 2
first_half = df.iloc[:half_point]
second_half = df.iloc[half_point:]

# Ensure the two halves are not identical
assert not first_half.equals(
second_half
), "The first half of the data is identical to the second half."

0 comments on commit 536dc28

Please sign in to comment.