From f2c84757bb2f787010040c7feb8af47f9c8335dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=87a=C4=9Fatay?= Date: Sat, 31 Oct 2020 11:26:46 +0300 Subject: [PATCH] add yes or no tests --- tests/test_validation.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/test_validation.py b/tests/test_validation.py index e72a88a..5028603 100644 --- a/tests/test_validation.py +++ b/tests/test_validation.py @@ -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()