diff --git a/tests/test_regexparser.py b/tests/test_regexparser.py index 5082128..2d38a0a 100644 --- a/tests/test_regexparser.py +++ b/tests/test_regexparser.py @@ -60,10 +60,19 @@ def test_any_character(): string=f'ab{character * num_repeats}123', regex='ab.+123', expect_success=expect_success) - + + def test_dates(): # https://stackoverflow.com/q/15491894 , removed the ^ and $ because interegular doesn't support them date_regex = r'(0?[1-9]|[12][0-9]|3[01])[\/\-](0?[1-9]|1[012])[\/\-]\d{4}' _test_regex_parsing_with_string('01/01/2020', date_regex, True) _test_regex_parsing_with_string('29/04/1986', date_regex, True) - _test_regex_parsing_with_string('001/01/2020', date_regex, False) \ No newline at end of file + _test_regex_parsing_with_string('001/01/2020', date_regex, False) + + +def test_string_choice(): + choice_regex = r'abc|def|ghi' + _test_regex_parsing_with_string('abc', choice_regex, True) + _test_regex_parsing_with_string('def', choice_regex, True) + _test_regex_parsing_with_string('ghi', choice_regex, True) + _test_regex_parsing_with_string('aei', choice_regex, False)