예제 #1
0
def test_model_regex_is_not_valid():
    regex = Regex('[', parse=False)
    assert not regex.is_valid()
예제 #2
0
def test_model_regex_match_case_insensitive():
    regex = Regex('test', match_case=False)
    assert regex.value == '(?i)test'
예제 #3
0
def test_model_regex():
    regex = Regex('test')
    assert regex.value == 'test'
예제 #4
0
def test_model_regex_is_valid():
    regex = Regex('test', parse=False)
    assert regex.is_valid()
예제 #5
0
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)[^$]*)$'
예제 #6
0
def test_model_regex_match_word():
    regex = Regex('Test', match_word=True)
    assert regex.value == r'^(.*?(\b' + r'Test' + r'\b)[^$]*)$'
예제 #7
0
def test_model_regex_match_case_sensitive():
    regex = Regex('Test', match_case=True)
    assert regex.value == 'Test'