def test_regset_repr(): assert repr(_RegSet('ohai', r'\Aworld')) == r"_RegSet('ohai', '\\Aworld')"
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
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
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