Exemplo n.º 1
0
def test_regex_norm():
    ts = TextSearch("insensitive", "norm")
    ts.add_regex_handler(["last "], r"\d", keep_result=True)
    assert ts.findall("last 5") == ["last 5"]
Exemplo n.º 2
0
def test_regex_overlap():
    ts = TextSearch("insensitive", "object")
    ts.add_regex_handler(["last "], r"\d", keep_result=True)
    ts.add("last")
    assert ts.findall("last 5")[0].norm == "last 5"
Exemplo n.º 3
0
def test_postfix_regex():
    ts = TextSearch("ignore", "norm")
    ts.add_regex_handler(["products"], r"\d+ ", keep_result=True, prefix=False)
    assert ts.findall("90 products") == ["90 products"]