def test_aggr_exceed_count(states, expected_best_state, expected_worst_state):
    best_aggr_config = BIAggregationFunctionBest.schema()().dump({"count": 5})
    best_aggr_function = BIAggregationFunctionBest(best_aggr_config)
    assert best_aggr_function.aggregate(states) == expected_best_state

    worst_aggr_config = BIAggregationFunctionWorst.schema()().dump({"count": 5})
    worst_aggr_function = BIAggregationFunctionWorst(worst_aggr_config)
    assert worst_aggr_function.aggregate(states) == expected_worst_state
def test_aggr_restrict_state_warn(states, expected_best_state, expected_worst_state):
    best_aggr_config = BIAggregationFunctionBest.schema()().dump({"restrict_state": 1})
    best_aggr_function = BIAggregationFunctionBest(best_aggr_config)
    assert best_aggr_function.aggregate(states) == expected_best_state

    worst_aggr_config = BIAggregationFunctionWorst.schema()().dump({"restrict_state": 1})
    worst_aggr_function = BIAggregationFunctionWorst(worst_aggr_config)
    assert worst_aggr_function.aggregate(states) == expected_worst_state
예제 #3
0
def test_aggr_default(states, expected_best_state, expected_worst_state):
    best_aggr_config = BIAggregationFunctionBest.schema()().dump({}).data
    best_aggr_function = BIAggregationFunctionBest(best_aggr_config)
    assert best_aggr_function.aggregate(states) == expected_best_state

    worst_aggr_config = BIAggregationFunctionWorst.schema()().dump({}).data
    worst_aggr_function = BIAggregationFunctionWorst(worst_aggr_config)
    assert worst_aggr_function.aggregate(states) == expected_worst_state