Skip to content

Commit

Permalink
Appease linter
Browse files Browse the repository at this point in the history
  • Loading branch information
tleyden committed Dec 4, 2023
1 parent 293a169 commit 3019d59
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tests/datasets/reading_comprehension_generation/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from dalm.datasets.reading_comprehension_generation.utils import _raw_question_and_answer_extractor, question_and_answer_extractor
from typing import Dict, Iterator, List, Optional, Tuple

from typing import Dict, List, cast

def test_question_and_answer_extractor() -> None:
chat_completions = question_and_answer_extractor(
Expand Down Expand Up @@ -191,15 +190,17 @@ def test_raw_question_and_answer_extractor() -> None:
whole_text=str(test_case["whole_text"])
)

expected_qa_pairs = test_case["expected_output"]
# The cast is necessary because linter doesn't know that the test case is a dict.
expected_qa_pairs = cast(List[Dict[str, str]], test_case["expected_output"])

assert result_qa_pairs is not None
assert expected_qa_pairs is not None

assert len(result_qa_pairs) == len(expected_qa_pairs)

for i, result_qa_pair in enumerate(result_qa_pairs):
expected_qa_pair = expected_qa_pairs[i]
expected_qa_pair= expected_qa_pairs[i]

assert result_qa_pair is not None
assert expected_qa_pair is not None

Expand Down

0 comments on commit 3019d59

Please sign in to comment.