def test_chunk2doc_ranker_driver_max_ranker():
    doc = create_document_to_score()
    driver = SimpleChunk2DocRankDriver()
    executor = MaxRanker()
    driver.attach(executor=executor, pea=None)
    driver._apply_all(doc.chunks, doc)
    assert (len(doc.matches) == 4)
    assert (doc.matches[0].id == 70)
    assert (doc.matches[0].score.value == 7)
    assert (doc.matches[1].id == 60)
    assert (doc.matches[1].score.value == 6)
    assert (doc.matches[2].id == 50)
    assert (doc.matches[2].score.value == 5)
    assert (doc.matches[3].id == 40)
    assert (doc.matches[3].score.value == 4)
    for match in doc.matches:
        assert (match.score.ref_id == doc.id)
def test_chunk2doc_ranker_driver_max_ranker():
    doc = create_document_to_score()
    driver = SimpleChunk2DocRankDriver()
    executor = MaxRanker()
    driver.attach(executor=executor, pea=None)
    driver._apply_all(doc.chunks, doc)
    assert (len(doc.matches) == 4)
    assert (doc.matches[0].id == 70)
    assert (doc.matches[0].score.value == 7)
    assert (doc.matches[1].id == 60)
    assert (doc.matches[1].score.value == 6)
    assert (doc.matches[2].id == 50)
    assert (doc.matches[2].score.value == 5)
    assert (doc.matches[3].id == 40)
    assert (doc.matches[3].score.value == 4)
    for match in doc.matches:
        assert (match.score.ref_id == doc.id)