Esempio n. 1
0
def test__matches__identifies_from_compiled_expressions():

    match = matches(re.compile('a|bb*'))

    assert match('a')
    assert match('bbb')
    assert not match('c')
Esempio n. 2
0
def test__matches__identifies_matching_expressions():

    match = matches('a|bb*')

    assert match('a')
    assert match('bbb')
    assert match('abb')
    assert not match('c')
Esempio n. 3
0
def test__punctuation__matches_typical():

    match = matches(teeth.pattern.punctuation)

    assert match('.')
    assert match('?!')
    assert match('???')
    assert match('--')
    assert match('...')

    assert not match('ok')
    assert not match(' ')
Esempio n. 4
0
 def the_letter_e(x):
     return matches('e')(x)
Esempio n. 5
0
 def word_ends(x):
     return matches('[ \n!]+')(x)
Esempio n. 6
0
 def sentence_ends(x):
     return matches('[.?!]')(x)