Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions tests/test_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,25 @@ def test_pick_from_choices_mixed_types(self):
expect(actual is expected, f"In: {i}")

assert_expectations()

def test_yes_or_no(self):
inputs = ["y", "Y", "n", "N"]
expected = True

for i in inputs:
actual = yes_or_no(i)
expect(actual is expected)

assert_expectations()

def test_yes_or_no_with_other_letters(self):
letters = list(string.ascii_lowercase) + list(string.ascii_uppercase)
validInputs = ["y", "Y", "n", "N"]
invalidInputs = filter(lambda x: x not in validInputs, letters)
expected = False

for i in invalidInputs:
actual = yes_or_no(i)
expect(actual is expected)

assert_expectations()