def test_entity_evaluation_report(tmpdir_factory):
    path = tmpdir_factory.mktemp('evaluation').strpath
    report_folder = os.path.join(path, 'reports')
    mock_extractors = ['A', 'B']
    report_filename_a = os.path.join(report_folder, 'A_report.json')
    report_filename_b = os.path.join(report_folder, 'B_report.json')
    utils.create_dir(report_folder)
    result = evaluate_entities([EN_targets], [EN_predicted], [EN_tokens], mock_extractors, report_folder)
    report_a = json.loads(utils.read_file(report_filename_a))
    report_b = json.loads(utils.read_file(report_filename_b))
    assert (len(report_a) == 8)
    assert (report_a['datetime']['support'] == 1.0)
    assert (report_b['macro avg']['recall'] == 0.2)
    assert (result['A']['accuracy'] == 0.75)
def test_entity_evaluation_report(tmpdir_factory):
    path = tmpdir_factory.mktemp('evaluation').strpath
    report_folder = os.path.join(path, 'reports')
    mock_extractors = ['A', 'B']
    report_filename_a = os.path.join(report_folder, 'A_report.json')
    report_filename_b = os.path.join(report_folder, 'B_report.json')
    utils.create_dir(report_folder)
    result = evaluate_entities([EN_targets], [EN_predicted], [EN_tokens], mock_extractors, report_folder)
    report_a = json.loads(utils.read_file(report_filename_a))
    report_b = json.loads(utils.read_file(report_filename_b))
    assert (len(report_a) == 8)
    assert (report_a['datetime']['support'] == 1.0)
    assert (report_b['macro avg']['recall'] == 0.2)
    assert (result['A']['accuracy'] == 0.75)