diff --git a/tests/tantivy_test.py b/tests/tantivy_test.py index 8c3b636..81c2f9c 100644 --- a/tests/tantivy_test.py +++ b/tests/tantivy_test.py @@ -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 diff --git a/tests/test_index/.managed.json b/tests/test_index/.managed.json deleted file mode 100644 index 029c8e7..0000000 --- a/tests/test_index/.managed.json +++ /dev/null @@ -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"] diff --git a/tests/test_index/.tantivy-meta.lock b/tests/test_index/.tantivy-meta.lock deleted file mode 100644 index e69de29..0000000 diff --git a/tests/test_index/.tantivy-writer.lock b/tests/test_index/.tantivy-writer.lock deleted file mode 100644 index e69de29..0000000 diff --git a/tests/test_index/1fc74026b3954090b69817d58bcce59a.fast b/tests/test_index/1fc74026b3954090b69817d58bcce59a.fast deleted file mode 100644 index 707c720..0000000 Binary files a/tests/test_index/1fc74026b3954090b69817d58bcce59a.fast and /dev/null differ diff --git a/tests/test_index/1fc74026b3954090b69817d58bcce59a.fieldnorm b/tests/test_index/1fc74026b3954090b69817d58bcce59a.fieldnorm deleted file mode 100644 index fbf2687..0000000 Binary files a/tests/test_index/1fc74026b3954090b69817d58bcce59a.fieldnorm and /dev/null differ diff --git a/tests/test_index/1fc74026b3954090b69817d58bcce59a.idx b/tests/test_index/1fc74026b3954090b69817d58bcce59a.idx deleted file mode 100644 index 2c13ad6..0000000 Binary files a/tests/test_index/1fc74026b3954090b69817d58bcce59a.idx and /dev/null differ diff --git a/tests/test_index/1fc74026b3954090b69817d58bcce59a.pos b/tests/test_index/1fc74026b3954090b69817d58bcce59a.pos deleted file mode 100644 index 32c6395..0000000 Binary files a/tests/test_index/1fc74026b3954090b69817d58bcce59a.pos and /dev/null differ diff --git a/tests/test_index/1fc74026b3954090b69817d58bcce59a.posidx b/tests/test_index/1fc74026b3954090b69817d58bcce59a.posidx deleted file mode 100644 index 67ae764..0000000 Binary files a/tests/test_index/1fc74026b3954090b69817d58bcce59a.posidx and /dev/null differ diff --git a/tests/test_index/1fc74026b3954090b69817d58bcce59a.store b/tests/test_index/1fc74026b3954090b69817d58bcce59a.store deleted file mode 100644 index ffa0b21..0000000 Binary files a/tests/test_index/1fc74026b3954090b69817d58bcce59a.store and /dev/null differ diff --git a/tests/test_index/1fc74026b3954090b69817d58bcce59a.term b/tests/test_index/1fc74026b3954090b69817d58bcce59a.term deleted file mode 100644 index fe21ca9..0000000 Binary files a/tests/test_index/1fc74026b3954090b69817d58bcce59a.term and /dev/null differ diff --git a/tests/test_index/8949f79450d349e2bd51d885f44c354f.fast b/tests/test_index/8949f79450d349e2bd51d885f44c354f.fast deleted file mode 100644 index 707c720..0000000 Binary files a/tests/test_index/8949f79450d349e2bd51d885f44c354f.fast and /dev/null differ diff --git a/tests/test_index/8949f79450d349e2bd51d885f44c354f.fieldnorm b/tests/test_index/8949f79450d349e2bd51d885f44c354f.fieldnorm deleted file mode 100644 index 5610bf0..0000000 Binary files a/tests/test_index/8949f79450d349e2bd51d885f44c354f.fieldnorm and /dev/null differ diff --git a/tests/test_index/8949f79450d349e2bd51d885f44c354f.idx b/tests/test_index/8949f79450d349e2bd51d885f44c354f.idx deleted file mode 100644 index f63fec0..0000000 Binary files a/tests/test_index/8949f79450d349e2bd51d885f44c354f.idx and /dev/null differ diff --git a/tests/test_index/8949f79450d349e2bd51d885f44c354f.pos b/tests/test_index/8949f79450d349e2bd51d885f44c354f.pos deleted file mode 100644 index 69726f8..0000000 Binary files a/tests/test_index/8949f79450d349e2bd51d885f44c354f.pos and /dev/null differ diff --git a/tests/test_index/8949f79450d349e2bd51d885f44c354f.posidx b/tests/test_index/8949f79450d349e2bd51d885f44c354f.posidx deleted file mode 100644 index c4716ec..0000000 Binary files a/tests/test_index/8949f79450d349e2bd51d885f44c354f.posidx and /dev/null differ diff --git a/tests/test_index/8949f79450d349e2bd51d885f44c354f.store b/tests/test_index/8949f79450d349e2bd51d885f44c354f.store deleted file mode 100644 index 6a2f543..0000000 Binary files a/tests/test_index/8949f79450d349e2bd51d885f44c354f.store and /dev/null differ diff --git a/tests/test_index/8949f79450d349e2bd51d885f44c354f.term b/tests/test_index/8949f79450d349e2bd51d885f44c354f.term deleted file mode 100644 index 6f2c110..0000000 Binary files a/tests/test_index/8949f79450d349e2bd51d885f44c354f.term and /dev/null differ diff --git a/tests/test_index/f79c6d0a68e04210a4d026ecf151a1e7.fast b/tests/test_index/f79c6d0a68e04210a4d026ecf151a1e7.fast deleted file mode 100644 index 707c720..0000000 Binary files a/tests/test_index/f79c6d0a68e04210a4d026ecf151a1e7.fast and /dev/null differ diff --git a/tests/test_index/f79c6d0a68e04210a4d026ecf151a1e7.fieldnorm b/tests/test_index/f79c6d0a68e04210a4d026ecf151a1e7.fieldnorm deleted file mode 100644 index c9dc5e3..0000000 Binary files a/tests/test_index/f79c6d0a68e04210a4d026ecf151a1e7.fieldnorm and /dev/null differ diff --git a/tests/test_index/f79c6d0a68e04210a4d026ecf151a1e7.idx b/tests/test_index/f79c6d0a68e04210a4d026ecf151a1e7.idx deleted file mode 100644 index 14ba696..0000000 Binary files a/tests/test_index/f79c6d0a68e04210a4d026ecf151a1e7.idx and /dev/null differ diff --git a/tests/test_index/f79c6d0a68e04210a4d026ecf151a1e7.pos b/tests/test_index/f79c6d0a68e04210a4d026ecf151a1e7.pos deleted file mode 100644 index f94ad12..0000000 Binary files a/tests/test_index/f79c6d0a68e04210a4d026ecf151a1e7.pos and /dev/null differ diff --git a/tests/test_index/f79c6d0a68e04210a4d026ecf151a1e7.posidx b/tests/test_index/f79c6d0a68e04210a4d026ecf151a1e7.posidx deleted file mode 100644 index f826f16..0000000 Binary files a/tests/test_index/f79c6d0a68e04210a4d026ecf151a1e7.posidx and /dev/null differ diff --git a/tests/test_index/f79c6d0a68e04210a4d026ecf151a1e7.store b/tests/test_index/f79c6d0a68e04210a4d026ecf151a1e7.store deleted file mode 100644 index 9969480..0000000 Binary files a/tests/test_index/f79c6d0a68e04210a4d026ecf151a1e7.store and /dev/null differ diff --git a/tests/test_index/f79c6d0a68e04210a4d026ecf151a1e7.term b/tests/test_index/f79c6d0a68e04210a4d026ecf151a1e7.term deleted file mode 100644 index 7d994f8..0000000 Binary files a/tests/test_index/f79c6d0a68e04210a4d026ecf151a1e7.term and /dev/null differ diff --git a/tests/test_index/meta.json b/tests/test_index/meta.json deleted file mode 100644 index a8d0b15..0000000 --- a/tests/test_index/meta.json +++ /dev/null @@ -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 -}