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
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
Beispiel #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
Beispiel #4
0
class BIRuleSchema(Schema):
    class Meta:
        ordered = True

    id = ReqString(
        default="",
        example="rule1",
        description="TODO: Hier muß Andreas noch etwas reinschreiben!",
    )
    nodes = ReqList(
        fields.Nested(BINodeGeneratorSchema),
        default=[],
        example=[],
        description="TODO: Hier muß Andreas noch etwas reinschreiben!",
    )
    params = create_nested_schema_for_class(
        BIParams,
        example_config={
            "arguments": ["foo", "bar"],
        },
    )
    node_visualization = create_nested_schema(
        BINodeVisLayoutStyleSchema, default_schema=BINodeVisBlockStyleSchema)
    properties = create_nested_schema_for_class(BIRuleProperties)
    aggregation_function = create_nested_schema(
        BIAggregationFunctionSchema,
        default_schema=BIAggregationFunctionBest.schema())
    computation_options = create_nested_schema_for_class(
        BIRuleComputationOptions)
Beispiel #5
0
class BIRuleSchema(Schema):
    id = ReqString(default="", example="rule1")
    nodes = ReqList(fields.Nested(BINodeGeneratorSchema), default=[], example=[])
    params = create_nested_schema_for_class(BIParams,
                                            example_config=[{
                                                "arguments": ["foo", "bar"],
                                            }])
    node_visualization = create_nested_schema(BINodeVisLayoutStyleSchema,
                                              default_schema=BINodeVisBlockStyleSchema)
    properties = create_nested_schema_for_class(BIRuleProperties)
    aggregation_function = create_nested_schema(BIAggregationFunctionSchema,
                                                default_schema=BIAggregationFunctionBest.schema())
    computation_options = create_nested_schema_for_class(BIRuleComputationOptions)