Exemplo n.º 1
0
def test_foreign_chars():
    ts = TextSearch("ignore", "norm", replace_foreign_chars=True)
    ts.add("á", "A")
    assert "a" in ts
    assert "á" in ts
    assert ts.contains("a")
    assert ts.contains("á")
    assert ts.findall("a")
    assert ts.findall("á")
    assert ts.find_overlapping("a")
    assert ts.find_overlapping("á")
    assert ts.replace("a") == "A"
    assert ts.replace("á") == "A"
Exemplo n.º 2
0
def test_overlap():
    ts = TextSearch("ignore", "norm")
    ts.add("hi")
    ts.add("hi hi")
    assert len(ts.find_overlapping("hi hi")) == 3