def test_chunk2doc_ranker_driver_traverse_apply():
    docs = [create_chunk_matches_to_score()]
    driver = SimpleChunk2DocRankDriver(recur_range=(0, 1))
    executor = MinRanker()
    driver.attach(executor=executor, pea=None)
    driver._traverse_apply(docs)
    for doc in docs:
        assert (len(doc.matches) == 2)
        for (idx, m) in enumerate(doc.matches):
            assert (m.score.value == pytest.approx((1.0 / (1 + (m.id * 2.0))), 0.0001))
def test_chunk2doc_ranker_driver_traverse_apply():
    docs = [create_chunk_matches_to_score()]
    driver = SimpleChunk2DocRankDriver(recur_range=(0, 1))
    executor = MinRanker()
    driver.attach(executor=executor, pea=None)
    driver._traverse_apply(docs)
    for doc in docs:
        assert (len(doc.matches) == 2)
        for (idx, m) in enumerate(doc.matches):
            assert (m.score.value == pytest.approx((1.0 / (1 + (m.id * 2.0))), 0.0001))