Skip to content

Commit

Permalink
test: add tests for double check
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Amberson committed Oct 31, 2024
1 parent 82ee548 commit 0e0b1d4
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/test_hebikani.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,35 @@ def test_question_add_wrong_answers():
assert question.wrong_answer_count == 2


# first value is input for answer; the second is input for double_check
@patch("builtins.input", side_effect=["change me to correct", "y"])
def test_double_check_y(input_mock):
"""Test if the question is not marked wrong when double check overrides it."""
subject = Subject(get_specific_subjects["data"][0])
options = ClientOptions(double_check=True)
client = Client(API_KEY, options)
session = ReviewSession(client, [subject])
question = subject.meaning_question
answer_type = session.ask_answer(question)
print(answer_type)
session.process_answer(question, answer_type)
assert question.wrong_answer_count == 0


# first value is input for answer; the second is input for double_check
@patch("builtins.input", side_effect=["leave me incorrect", "n"])
def test_double_check_n(input_mock):
"""Test if the question is marked wrong when double check does not override it."""
subject = Subject(get_specific_subjects["data"][0])
options = ClientOptions(double_check=True)
client = Client(API_KEY, options)
session = ReviewSession(client, [subject])
question = subject.meaning_question
answer_type = session.ask_answer(question)
session.process_answer(question, answer_type)
assert question.wrong_answer_count == 1


def test_question_answer_values():
"""Test the question answer values."""
subject = Subject(double_reading_subject)
Expand Down

0 comments on commit 0e0b1d4

Please sign in to comment.