def test_intent_evaluation_report(tmpdir_factory):
    path = tmpdir_factory.mktemp('evaluation').strpath
    report_folder = os.path.join(path, 'reports')
    report_filename = os.path.join(report_folder, 'intent_report.json')
    utils.create_dir(report_folder)
    intent_results = [IntentEvaluationResult('', 'restaurant_search', 'I am hungry', 0.12345), IntentEvaluationResult('greet', 'greet', 'hello', 0.98765)]
    result = evaluate_intents(intent_results, report_folder, successes_filename=None, errors_filename=None, confmat_filename=None, intent_hist_filename=None)
    report = json.loads(utils.read_file(report_filename))
    greet_results = {'precision': 1.0, 'recall': 1.0, 'f1-score': 1.0, 'support': 1}
    prediction = {'text': 'hello', 'intent': 'greet', 'predicted': 'greet', 'confidence': 0.98765}
    assert (len(report.keys()) == 4)
    assert (report['greet'] == greet_results)
    assert (result['predictions'][0] == prediction)
def test_intent_evaluation_report(tmpdir_factory):
    path = tmpdir_factory.mktemp('evaluation').strpath
    report_folder = os.path.join(path, 'reports')
    report_filename = os.path.join(report_folder, 'intent_report.json')
    utils.create_dir(report_folder)
    intent_results = [IntentEvaluationResult(, 'restaurant_search', 'I am hungry', 0.12345), IntentEvaluationResult('greet', 'greet', 'hello', 0.98765)]
    result = evaluate_intents(intent_results, report_folder, successes_filename=None, errors_filename=None, confmat_filename=None, intent_hist_filename=None)
    report = json.loads(utils.read_file(report_filename))
    greet_results = {'precision': 1.0, 'recall': 1.0, 'f1-score': 1.0, 'support': 1}
    prediction = {'text': 'hello', 'intent': 'greet', 'predicted': 'greet', 'confidence': 0.98765}
    assert (len(report.keys()) == 4)
    assert (report['greet'] == greet_results)
    assert (result['predictions'][0] == prediction)