Exemple #1
0
def test_regset_repr():
    assert repr(_RegSet('ohai', r'\Aworld')) == r"_RegSet('ohai', '\\Aworld')"
Exemple #2
0
def test_regset_boundary():
    regset = _RegSet(r'\Ghello', 'hello')
    idx, _ = regset.search('ohello', 1, first_line=True, boundary=True)
    assert idx == 0
    idx, _ = regset.search('ohello', 1, first_line=True, boundary=False)
    assert idx == 1
Exemple #3
0
def test_regset_neither():
    regset = _RegSet(r'\Ahello', r'\Ghello', 'hello')
    idx, _ = regset.search('hello', 0, first_line=False, boundary=False)
    assert idx == 2
    idx, _ = regset.search('ohello', 1, first_line=False, boundary=False)
    assert idx == 2
Exemple #4
0
def test_regset_first_line():
    regset = _RegSet(r'\Ahello', 'hello')
    idx, _ = regset.search('hello', 0, first_line=True, boundary=True)
    assert idx == 0
    idx, _ = regset.search('hello', 0, first_line=False, boundary=True)
    assert idx == 1