From 27340e91bf03c04728c34a71c7096c37059a6e20 Mon Sep 17 00:00:00 2001 From: Antoine G <325288+saroh@users.noreply.github.com> Date: Wed, 27 Apr 2022 03:48:19 +0200 Subject: [PATCH] remove test index files and edit tests accordingly (#46) --- tests/tantivy_test.py | 16 ++----- tests/test_index/.managed.json | 1 - tests/test_index/.tantivy-meta.lock | 0 tests/test_index/.tantivy-writer.lock | 0 .../1fc74026b3954090b69817d58bcce59a.fast | Bin 5 -> 0 bytes ...1fc74026b3954090b69817d58bcce59a.fieldnorm | Bin 19 -> 0 bytes .../1fc74026b3954090b69817d58bcce59a.idx | Bin 189 -> 0 bytes .../1fc74026b3954090b69817d58bcce59a.pos | Bin 161 -> 0 bytes .../1fc74026b3954090b69817d58bcce59a.posidx | Bin 27 -> 0 bytes .../1fc74026b3954090b69817d58bcce59a.store | Bin 68 -> 0 bytes .../1fc74026b3954090b69817d58bcce59a.term | Bin 1022 -> 0 bytes .../8949f79450d349e2bd51d885f44c354f.fast | Bin 5 -> 0 bytes ...8949f79450d349e2bd51d885f44c354f.fieldnorm | Bin 19 -> 0 bytes .../8949f79450d349e2bd51d885f44c354f.idx | Bin 91 -> 0 bytes .../8949f79450d349e2bd51d885f44c354f.pos | Bin 145 -> 0 bytes .../8949f79450d349e2bd51d885f44c354f.posidx | Bin 27 -> 0 bytes .../8949f79450d349e2bd51d885f44c354f.store | Bin 76 -> 0 bytes .../8949f79450d349e2bd51d885f44c354f.term | Bin 446 -> 0 bytes .../f79c6d0a68e04210a4d026ecf151a1e7.fast | Bin 5 -> 0 bytes ...f79c6d0a68e04210a4d026ecf151a1e7.fieldnorm | Bin 19 -> 0 bytes .../f79c6d0a68e04210a4d026ecf151a1e7.idx | Bin 115 -> 0 bytes .../f79c6d0a68e04210a4d026ecf151a1e7.pos | Bin 113 -> 0 bytes .../f79c6d0a68e04210a4d026ecf151a1e7.posidx | Bin 27 -> 0 bytes .../f79c6d0a68e04210a4d026ecf151a1e7.store | Bin 65 -> 0 bytes .../f79c6d0a68e04210a4d026ecf151a1e7.term | Bin 649 -> 0 bytes tests/test_index/meta.json | 44 ------------------ 26 files changed, 5 insertions(+), 56 deletions(-) delete mode 100644 tests/test_index/.managed.json delete mode 100644 tests/test_index/.tantivy-meta.lock delete mode 100644 tests/test_index/.tantivy-writer.lock delete mode 100644 tests/test_index/1fc74026b3954090b69817d58bcce59a.fast delete mode 100644 tests/test_index/1fc74026b3954090b69817d58bcce59a.fieldnorm delete mode 100644 tests/test_index/1fc74026b3954090b69817d58bcce59a.idx delete mode 100644 tests/test_index/1fc74026b3954090b69817d58bcce59a.pos delete mode 100644 tests/test_index/1fc74026b3954090b69817d58bcce59a.posidx delete mode 100644 tests/test_index/1fc74026b3954090b69817d58bcce59a.store delete mode 100644 tests/test_index/1fc74026b3954090b69817d58bcce59a.term delete mode 100644 tests/test_index/8949f79450d349e2bd51d885f44c354f.fast delete mode 100644 tests/test_index/8949f79450d349e2bd51d885f44c354f.fieldnorm delete mode 100644 tests/test_index/8949f79450d349e2bd51d885f44c354f.idx delete mode 100644 tests/test_index/8949f79450d349e2bd51d885f44c354f.pos delete mode 100644 tests/test_index/8949f79450d349e2bd51d885f44c354f.posidx delete mode 100644 tests/test_index/8949f79450d349e2bd51d885f44c354f.store delete mode 100644 tests/test_index/8949f79450d349e2bd51d885f44c354f.term delete mode 100644 tests/test_index/f79c6d0a68e04210a4d026ecf151a1e7.fast delete mode 100644 tests/test_index/f79c6d0a68e04210a4d026ecf151a1e7.fieldnorm delete mode 100644 tests/test_index/f79c6d0a68e04210a4d026ecf151a1e7.idx delete mode 100644 tests/test_index/f79c6d0a68e04210a4d026ecf151a1e7.pos delete mode 100644 tests/test_index/f79c6d0a68e04210a4d026ecf151a1e7.posidx delete mode 100644 tests/test_index/f79c6d0a68e04210a4d026ecf151a1e7.store delete mode 100644 tests/test_index/f79c6d0a68e04210a4d026ecf151a1e7.term delete mode 100644 tests/test_index/meta.json 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 707c720ff0147fbbf08df5514ea03da0c9b28b56..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5 McmZo*WME(b00M~sf&c&j diff --git a/tests/test_index/1fc74026b3954090b69817d58bcce59a.fieldnorm b/tests/test_index/1fc74026b3954090b69817d58bcce59a.fieldnorm deleted file mode 100644 index fbf2687e9306f645d171f5328efafd61a606423e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 19 UcmZRvYHDBrf`&#$5XlQ903uuh&;S4c diff --git a/tests/test_index/1fc74026b3954090b69817d58bcce59a.idx b/tests/test_index/1fc74026b3954090b69817d58bcce59a.idx deleted file mode 100644 index 2c13ad64ffce2ad9c26bfc144eca65bd0c329c6d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 189 zcmZQ!fPjWZ2+T(C+hAe@=q9jya|48ingiDZ5pROZBCA1W!*ull^`VNxc+CxsO${K& MHB4Xxk-R_x0L)TRe*gdg diff --git a/tests/test_index/1fc74026b3954090b69817d58bcce59a.pos b/tests/test_index/1fc74026b3954090b69817d58bcce59a.pos deleted file mode 100644 index 32c63959bb879b666a6e147de048556205558247..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 161 zcmZQ#U|?VdVn!gw1{zK-_fii(S*)9JQbznrfXKRlM@G`GOtyNh zYH$cNj5x}a?ElrWOL?u6;a)f9tYk&PxXe2k}A)k4nWE28{(0Ym5$VV4OH( b35$(bE=SHfWeh8u8bCq~3qbB^-~|!@^xrIC diff --git a/tests/test_index/1fc74026b3954090b69817d58bcce59a.posidx b/tests/test_index/1fc74026b3954090b69817d58bcce59a.posidx deleted file mode 100644 index 67ae7649281f7ad5965c852fbd4095e787588733..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 27 YcmZQ#00MRp(bNDU8(JAbBrlKv03Q4Tp8x;= diff --git a/tests/test_index/1fc74026b3954090b69817d58bcce59a.store b/tests/test_index/1fc74026b3954090b69817d58bcce59a.store deleted file mode 100644 index ffa0b21f77ee6db22686b90591e224000c843816..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 68 zcmdO7U|{&q#=ubQml#kG$tcahz}9x~%CttHFatxsf0}}CW^$@RVqS`ZZ)#p+XQM7y Lf`I`>GXnVlK4}ga diff --git a/tests/test_index/1fc74026b3954090b69817d58bcce59a.term b/tests/test_index/1fc74026b3954090b69817d58bcce59a.term deleted file mode 100644 index fe21ca9bd00a061346ff0cb796c979c7929f9017..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1022 zcmZWnZAcVr6n@Xlj=Gk1UNzCO?rddbRFo8zd4H^NFMU&yQBu&BYi_JNHtkw=Z=uVk zc{S}W_x3IHK}0_yilPsS*lo8NcdDtR4;6nXL{voF9~X)UIwQLf^};*v;XLPkpXWSt z1op$iu)(mMVK4yUMD(!=r{isAmRpCN2aoI-R z$tzS9uiGMNkDGeGgu!Q~h`|v7c2yycQyA7Cm?m*_dt6)~gqDAokBgVFwKtM5dda)^ z9X!#8K}(3Q&T_Lg`q1(-El(kL#XjsR!mh{=w(IeTLHUe;pIaORbKx9@G%e16xw(@r z%?H-ttKs5R48=Z?S7ShKkM=+5rE>c=Qc#6w2k=6|CJJmhNErc(!B!6P0Yk3Nq+V&bzUS87yMIRZ$D4XWk6NA{eEwHo$6)8s z;n(4}|9m*|-_`%GeZKkiHr$o&*&|u^d3)JVn!fl1!6+r0TKhoy<)nKFFJGzBYQV1Ut#Kt2G&j}RFE diff --git a/tests/test_index/8949f79450d349e2bd51d885f44c354f.term b/tests/test_index/8949f79450d349e2bd51d885f44c354f.term deleted file mode 100644 index 6f2c11069f5ff046c693b622888e7e9f44b8ed31..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 446 zcmZQ#Km!7kPBRE}A7vBhXAo#T#30agj)j?tk%5twlSiPWI6pU0kd+mx#TZJ?=y>iJgFyRbCZN0WGX6&K(5#lp`w>D99`-EGWRw$IH#h z#>&FLD5hd&X=~@`8JbgEQ4S1;yxh!;^t9BJL_uB&s2>hPX;^T;#9>~<8XRn_tP>@8 zg)~JcTgr-fsZNd370cc_z1voDj_a&7zS4U`=bVk@4T2ic)Bs{M{0EuTzzZY*Nia&~ diff --git a/tests/test_index/f79c6d0a68e04210a4d026ecf151a1e7.fast b/tests/test_index/f79c6d0a68e04210a4d026ecf151a1e7.fast deleted file mode 100644 index 707c720ff0147fbbf08df5514ea03da0c9b28b56..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5 McmZo*WME(b00M~sf&c&j diff --git a/tests/test_index/f79c6d0a68e04210a4d026ecf151a1e7.fieldnorm b/tests/test_index/f79c6d0a68e04210a4d026ecf151a1e7.fieldnorm deleted file mode 100644 index c9dc5e3ec672c69669cfc38218aea5b3bae34a8d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 19 UcmZS7X=-2qf`&#$5XlQ903jy=zW@LL diff --git a/tests/test_index/f79c6d0a68e04210a4d026ecf151a1e7.idx b/tests/test_index/f79c6d0a68e04210a4d026ecf151a1e7.idx deleted file mode 100644 index 14ba69692de5412a122985f96d74c02d39b8b278..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 115 scmZQ%fPjWZLpZCUv7rfw3Bwkknr1Y0O=x0fNBIw1FDNPR^1cmBBLBe)xR?P>i zP*D-lLl5@gNkI_ALx%n9E@<3}KMfwmiwCdXd@H+`&f$IYzM1*vd+%}Bvhc1adrlyK z1-3h2@nJs3JuxPH@^)(;^M_*O$-M+|MS6j~-nV>UFeeHlxazrp9e2Y?DGXR9x1(M& zRFMK~2eL1H3VFN}$j~ECENfH*w*YV296LS7c8J@iYl0Wh^xSn<_5hbXBGU_o;8SRl zw)r*iLTgjHMCYoy;0!9TP>--#td#`kq^l7EJ`Oy`mM$=+iULG_>V}vCddfFB@0L0X@x*=w(ePm$4gC84lnBB2!hW?ZDp2{KT%E<6~lYdp47%#*M;ZI0mO+ z9AMgiqZ1HNdQLj~vie8@A=G4+89*o;>#^Xw+nefSU;^QR!k1R8k zE_C|Gr$@(ToKNkgefv-Np|p-1J^5inNf(Q!!_U*j+1WFXzP#x!Y8NKHjXSrS>hAAn ghn{!!)y=mvuOC)k4F2*)tlDWso7T_huhuYyf4teERR910 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 -}