def test_max_results_preprocessor():
    from copy import deepcopy
    import numpy as np

    results = [{"a": 1, "b": 2}, {"a": 3, "b": 4}, {"a": 5, "b": 6}, {"a": 7, "b": 8}]
    expected = deepcopy(results)
    for res in expected:
        res.update(
            {
                "max(a)": np.max([result["a"] for result in results]),
                "max(b)": np.max([result["b"] for result in results]),
            }
        )

    preprocessor = MaxResultsPreprocessor(["a", "b"])
    preprocessed_results = preprocessor.preprocess(results)

    assert preprocessed_results == expected