remove test index files and edit tests accordingly (#46)

master
Antoine G 2022-04-27 03:48:19 +02:00 committed by GitHub
parent 8e97a1ebe7
commit 27340e91bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 5 additions and 56 deletions

View File

@ -1,7 +1,7 @@
import tantivy
import pytest
from tantivy import Document, Index, SchemaBuilder, Schema
from tantivy import Document, Index, SchemaBuilder
def schema():
@ -228,18 +228,12 @@ class TestUpdateClass(object):
assert len(result.hits) == 0
PATH_TO_INDEX = "tests/test_index/"
class TestFromDiskClass(object):
def test_exists(self):
# prefer to keep it separate in case anyone deletes this
# runs from the root directory
assert Index.exists(PATH_TO_INDEX)
def test_opens_from_dir_invalid_schema(self):
def test_opens_from_dir_invalid_schema(self, dir_index):
invalid_schema = SchemaBuilder().add_text_field("🐱").build()
index_dir, _ = dir_index
with pytest.raises(ValueError):
index = Index(schema(), PATH_TO_INDEX, reuse=True)
Index(invalid_schema, str(index_dir), reuse=True)
def test_opens_from_dir(self, dir_index):
index_dir, _ = dir_index

View File

@ -1 +0,0 @@
["1fc74026b3954090b69817d58bcce59a.fieldnorm","f79c6d0a68e04210a4d026ecf151a1e7.pos","1fc74026b3954090b69817d58bcce59a.store","meta.json","f79c6d0a68e04210a4d026ecf151a1e7.fieldnorm","8949f79450d349e2bd51d885f44c354f.fieldnorm","f79c6d0a68e04210a4d026ecf151a1e7.posidx","8949f79450d349e2bd51d885f44c354f.store","8949f79450d349e2bd51d885f44c354f.term","8949f79450d349e2bd51d885f44c354f.pos","1fc74026b3954090b69817d58bcce59a.posidx","1fc74026b3954090b69817d58bcce59a.pos","8949f79450d349e2bd51d885f44c354f.posidx","f79c6d0a68e04210a4d026ecf151a1e7.idx","1fc74026b3954090b69817d58bcce59a.fast","f79c6d0a68e04210a4d026ecf151a1e7.fast","f79c6d0a68e04210a4d026ecf151a1e7.term","1fc74026b3954090b69817d58bcce59a.term","8949f79450d349e2bd51d885f44c354f.idx","1fc74026b3954090b69817d58bcce59a.idx","f79c6d0a68e04210a4d026ecf151a1e7.store","8949f79450d349e2bd51d885f44c354f.fast"]

View File

@ -1,44 +0,0 @@
{
"segments": [
{
"segment_id": "1fc74026-b395-4090-b698-17d58bcce59a",
"max_doc": 1,
"deletes": null
},
{
"segment_id": "8949f794-50d3-49e2-bd51-d885f44c354f",
"max_doc": 1,
"deletes": null
},
{
"segment_id": "f79c6d0a-68e0-4210-a4d0-26ecf151a1e7",
"max_doc": 1,
"deletes": null
}
],
"schema": [
{
"name": "title",
"type": "text",
"options": {
"indexing": {
"record": "position",
"tokenizer": "default"
},
"stored": true
}
},
{
"name": "body",
"type": "text",
"options": {
"indexing": {
"record": "position",
"tokenizer": "default"
},
"stored": false
}
}
],
"opstamp": 6
}