Exemplo n.º 1
0
def test_evaluation_callback_no_name(responses):
    # test with no metric name given to callback
    cb = EvaluationCallback()
    cb(responses)
    cb(responses)

    evaluation = cb.get_mean_evaluation()
    eval_name = list(evaluation)[0]
    assert eval_name == 'metric1'

    score = evaluation[eval_name]
    assert score == 0.75
Exemplo n.º 2
0
def test_evaluation_callback_with_name(responses):
    # test with metric name given to callback
    evaluation_metric = 'metric2'
    cb = EvaluationCallback(evaluation_metric)
    cb(responses)
    cb(responses)

    evaluation = cb.get_mean_evaluation()
    eval_name = list(evaluation)[0]
    assert eval_name == evaluation_metric

    score = evaluation[eval_name]
    assert score == 0.5