def test_scores_calculate_parallel(): dummy_similarity_function = DummySimilarityFunctionParallel() scores = Scores(references=["r0", "r1", "r2"], queries=["q0", "q1"], similarity_function=dummy_similarity_function) scores.calculate() actual = list(scores) expected = [("r0", "q0", numpy.array([("r0q0", 4)], dtype=dummy_similarity_function.score_datatype)), ("r0", "q1", numpy.array([("r0q1", 4)], dtype=dummy_similarity_function.score_datatype)), ("r1", "q0", numpy.array([("r1q0", 4)], dtype=dummy_similarity_function.score_datatype)), ("r1", "q1", numpy.array([("r1q1", 4)], dtype=dummy_similarity_function.score_datatype)), ("r2", "q0", numpy.array([("r2q0", 4)], dtype=dummy_similarity_function.score_datatype)), ("r2", "q1", numpy.array([("r2q1", 4)], dtype=dummy_similarity_function.score_datatype))] assert actual == expected, "Expected different scores."
def test_scores_single_pair(): """Test single pair input.""" dummy_similarity_function = DummySimilarityFunction() scores = Scores(references=["A"], queries=["B"], similarity_function=dummy_similarity_function) scores.calculate() actual = scores.scores[0][0] expected = ('AB', 2) assert actual == expected, "Expected different scores."
def test_scores_calculate(): dummy_similarity_function = DummySimilarityFunction() scores = Scores(references=["r0", "r1", "r2"], queries=["q0", "q1"], similarity_function=dummy_similarity_function) scores.calculate() actual = list(scores) expected = [ ("r0", "q0", "r0q0", 4), ("r0", "q1", "r0q1", 4), ("r1", "q0", "r1q0", 4), ("r1", "q1", "r1q1", 4), ("r2", "q0", "r2q0", 4), ("r2", "q1", "r2q1", 4) ] assert actual == expected, "Expected different scores."