Exemple #1
0
def test_del():
    prepare_dir()
    f = create_delete_me()
    loogle.index(crawl_dir="sub", index_dir=idx)
    res = loogle.search("makaka", index_dir=idx)
    assert len(res) == 1
    os.remove(f)
    loogle.index(crawl_dir="sub", index_dir=idx)
    res = loogle.search("makaka", index_dir=idx)
    assert len(res) == 0
Exemple #2
0
def test_del():
    prepare_dir()
    f=create_delete_me()
    loogle.index(crawl_dir="sub",index_dir=idx)
    res = loogle.search("makaka", index_dir=idx)
    assert len(res) == 1
    os.remove(f)
    loogle.index(crawl_dir="sub",index_dir=idx)
    res = loogle.search("makaka", index_dir=idx)
    assert len(res) == 0
Exemple #3
0
def test_inc():
    prepare_dir()
    loogle.index(crawl_dir="sub", index_dir=idx, get_first_N=2)
    loogle.index(crawl_dir="sub", index_dir=idx, get_first_N=4)
    loogle.index(crawl_dir="sub", index_dir=idx)
    res = loogle.search("interest rate cash flow", index_dir=idx)
    assert 'veryveryimpo.txt' in res[0]
Exemple #4
0
def test_inc():
    prepare_dir()
    loogle.index(crawl_dir="sub",index_dir=idx,get_first_N=2)
    loogle.index(crawl_dir="sub",index_dir=idx,get_first_N=4)
    loogle.index(crawl_dir="sub",index_dir=idx)
    res = loogle.search("interest rate cash flow", index_dir=idx)
    assert 'veryveryimpo.txt' in res[0]
Exemple #5
0
def test_simple():
    prepare_dir()

    loogle.index(crawl_dir="sub", index_dir=idx, get_first_N=10)

    res = loogle.search("scientist", index_dir=idx)
    print res
    assert "a1" in res[0]

    res = loogle.search("manifesto", index_dir=idx)
    print res
    assert "b1" in res[0]

    res = loogle.search("drug bill", index_dir=idx)
    print res
    assert "b2" in res[0]

    res = loogle.search("amaranth", index_dir=idx)
    print res
    assert "2006_10_01_archive.html" in res[0]

    res = loogle.search("quadratic form", index_dir=idx)
    print res
    assert "tmp.pdf" in res[0]

    res = loogle.search("interest rate cash flow", index_dir=idx)
    print res
    assert "veryveryimpo.txt" in res[0]

    res = loogle.search("veryveryimpo", index_dir=idx)
    print res
    assert "veryveryimpo.txt" in res[0]
Exemple #6
0
def test_simple():
    prepare_dir()

    loogle.index(crawl_dir="sub",index_dir=idx,get_first_N=10)

    res = loogle.search("scientist", index_dir=idx)
    print res
    assert 'a1' in res[0]
    
    res = loogle.search("manifesto", index_dir=idx)
    print res
    assert 'b1' in res[0]

    res = loogle.search("drug bill", index_dir=idx)
    print res
    assert 'b2' in res[0]

    res = loogle.search("amaranth", index_dir=idx)
    print res
    assert '2006_10_01_archive.html' in res[0]

    res = loogle.search("quadratic form", index_dir=idx)
    print res
    assert 'tmp.pdf' in res[0]

    res = loogle.search("interest rate cash flow", index_dir=idx)
    print res
    assert 'veryveryimpo.txt' in res[0]

    res = loogle.search("veryveryimpo", index_dir=idx)
    print res
    assert 'veryveryimpo.txt' in res[0]    
Exemple #7
0
def test_update():
    prepare_dir()
    f = create_delete_me()
    loogle.index(crawl_dir="sub", index_dir=idx)
    fin = open(f, "a")
    fin.write("\n tonkatoy \n")
    fin.close()
    loogle.index(crawl_dir="sub", index_dir=idx)
    res = loogle.search("tonkatoy", index_dir=idx)
    assert 'delete_me' in res[0]
    os.remove(f)
Exemple #8
0
def test_update():
    prepare_dir()
    f = create_delete_me()
    loogle.index(crawl_dir="sub",index_dir=idx)
    fin = open(f,"a")
    fin.write("\n tonkatoy \n")
    fin.close()
    loogle.index(crawl_dir="sub",index_dir=idx)
    res = loogle.search("tonkatoy", index_dir=idx)
    assert 'delete_me' in res[0]    
    os.remove(f)    
Exemple #9
0
def test_simple():
    prepare_dir()

    loogle.index(crawl_dir="sub",index_dir=idx,get_first_N=5)

    res = loogle.search("scientist", index_dir=idx)
    print res
    assert 'a1' in res[0]
    
    res = loogle.search("manifesto", index_dir=idx)
    print res
    assert 'b1' in res[0]

    res = loogle.search("drug bill", index_dir=idx)
    print res
    assert 'b2' in res[0]

    res = loogle.search("interest rate cash flow", index_dir=idx)
    print res
    assert 'veryveryimpo.txt' in res[0]

    res = loogle.search("amaranth", index_dir=idx)
    print res
    assert '2006_10_01_archive.html' in res[0]

    res = loogle.search("veryveryimpo", index_dir=idx)
    print res
    assert 'veryveryimpo.txt' in res[0]