def test_model_regex_is_not_valid(): regex = Regex('[', parse=False) assert not regex.is_valid()
def test_model_regex_match_case_insensitive(): regex = Regex('test', match_case=False) assert regex.value == '(?i)test'
def test_model_regex(): regex = Regex('test') assert regex.value == 'test'
def test_model_regex_is_valid(): regex = Regex('test', parse=False) assert regex.is_valid()
def test_model_regex_multiple_words(): regex = Regex('Test,test', match_case=False, match_word=True) assert regex.value == r'(?i)^(.*?(\b' + r'Test' + r'\b)[^$]*)$|^(.*?(\b' + r'test' + r'\b)[^$]*)$'
def test_model_regex_match_word(): regex = Regex('Test', match_word=True) assert regex.value == r'^(.*?(\b' + r'Test' + r'\b)[^$]*)$'
def test_model_regex_match_case_sensitive(): regex = Regex('Test', match_case=True) assert regex.value == 'Test'