Skip to content

Commit

Permalink
Added unit test for key column unpacking.
Browse files Browse the repository at this point in the history
  • Loading branch information
pineapple-cat committed Apr 10, 2024
1 parent cbcaeeb commit 2e46df8
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions post-processing/test_post_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,23 @@ def test_display_name_parsing():
assert len(params) == 0


# Test that recursive unpacking of key columns works as expected
def test_key_col_unpacking():

test_dict1 = {"benchmark": "bench1", "bench1": {"compiler": {"name": "compiler1", "version": 9.2}}}
test_dict2 = {"benchmark": "bench2", "compiler": {"name": "compiler2", "version": 12.1},
"variants": {"cuda": True}, "mpi": ""}

# flatten test dicts into key columns dicts
key_cols = [log_hand.find_key_cols(r, key_cols={}) for r in [test_dict1, test_dict2]]

# expected results
assert key_cols == [
{"benchmark": "bench1", "bench1_compiler_name": "compiler1", "bench1_compiler_version": 9.2},
{"benchmark": "bench2", "compiler_name": "compiler2", "compiler_version": 12.1,
"variants_cuda": True, "mpi": ""}]


@pytest.fixture(scope="module")
# Fixture to run sombrero benchmark example, generate perflogs, and clean up after test
def run_sombrero():
Expand Down

0 comments on commit 2e46df8

Please sign in to comment.