aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2021-04-12 19:42:31 +0200
committerMartin Czygan <martin.czygan@gmail.com>2021-04-12 19:42:31 +0200
commit07c39548f848ded84bbce8455b974a5e298f1ea2 (patch)
tree03dfd6936667c3cfb3f2d8b96fd54ed6a004fbd7 /tests
parent81220a314a6bb179db3554ceb36958417535390f (diff)
downloadfuzzycat-07c39548f848ded84bbce8455b974a5e298f1ea2.tar.gz
fuzzycat-07c39548f848ded84bbce8455b974a5e298f1ea2.zip
address es hits.total change in ES7
* https://www.elastic.co/guide/en/elasticsearch/reference/current/breaking-changes-7.0.html
Diffstat (limited to 'tests')
-rw-r--r--tests/test_utils.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/test_utils.py b/tests/test_utils.py
index 29b125b..24be9d1 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -3,7 +3,7 @@ import os
from fuzzycat.utils import (author_similarity_score, cut, jaccard, nwise, slugify_string,
token_n_grams, tokenize_string, parse_page_string, dict_key_exists,
- zstdlines)
+ zstdlines, es_compat_hits_total)
def test_slugify_string():
@@ -98,3 +98,12 @@ def test_zstdlines():
for zfn, fn in examples:
with open(fn) as f:
assert [s.strip() for s in f.readlines()] == list(zstdlines(zfn))
+
+def test_es_compat_hits_total():
+ cases = (
+ ({"hits": {"total": 6}}, 6),
+ ({"hits": {"total": {"value": 7, "relation": "eq"}}}, 7),
+ )
+ for r, expected in cases:
+ assert es_compat_hits_total(r) == expected
+