Beispiel #1
0
def test_bad_good_doc_id():
    b = Document()
    b.id = 'hello'
    b.id = 'abcd' * 4
    b.id = 'de09' * 4
    b.id = 'af54' * 4
    b.id = 'abcdef0123456789'
Beispiel #2
0
def test_bad_good_doc_id():
    b = Document()
    with pytest.raises(BadDocID):
        b.id = 'hello'
    b.id = 'abcd' * 4
    b.id = 'de09' * 4
    b.id = 'af54' * 4
    b.id = 'abcdef0123456789'
Beispiel #3
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     doc1 = Document()
     doc1.id = '01' * 8
     doc1.tags['groundtruth'] = True
     doc2 = Document()
     doc2.id = '02' * 8
     doc2.tags['groundtruth'] = True
     doc4 = Document()
     doc4.id = '04' * 8
     doc4.tags['groundtruth'] = True
     self.db = {
         int(doc1.id): doc1.SerializeToString(),
         int(doc2.id): doc2.SerializeToString(),
         int(doc4.id): doc4.SerializeToString()
     }
Beispiel #4
0
def test_copy_construct():
    a = DocumentProto()
    b = Document(a, copy=True)
    a.id = '1' * 16
    assert b.id != '1' * 16

    b.id = '2' * 16
    assert a.id == '1' * 16
Beispiel #5
0
def eval_request():
    req = Request()
    req.request_type = 'search'
    # doc: 1
    # doc: 2
    # doc: 3
    # doc: 4
    # doc: 5 - will be missing from KV indexer
    for idx in range(5):
        dp = Document()
        dp.id = f'0{str(idx + 1)}' * 8
        req.docs.append(dp)
    return req