Skip to content

Commit dc5ef7e

Browse files
author
rgaudin
authored
Merge pull request #122 from openzim/dups
Remove duplicated bits
2 parents 17f806d + a2ce3a9 commit dc5ef7e

File tree

7 files changed

+20
-35
lines changed

7 files changed

+20
-35
lines changed

.flake8

Lines changed: 0 additions & 2 deletions
This file was deleted.

.gitignore

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ libzim_linux-*/
2424

2525
# Autogenerated files
2626
wrapper.*.so
27-
libzim/wrapper.cpp
28-
libzim/wrapper.h
29-
libzim/wrapper_api.h
27+
libzim/libzim.cpp
28+
libzim/libzim.h
29+
libzim/libzim_api.h
30+
31+
# custom-dev
32+
Pipfile
33+
.dev
34+
.env

Pipfile

Lines changed: 0 additions & 17 deletions
This file was deleted.

run_tests.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

setup.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,6 @@ test_requires =
4646

4747
[isort]
4848
profile = black
49+
50+
[flake8]
51+
max-line-length = 88

tasks.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
from invoke import task
99

10-
MAX_LINE_LENGTH = 88
11-
1210

1311
@task
1412
def build_ext(c):
@@ -37,17 +35,17 @@ def install_dev(c):
3735

3836
@task
3937
def check(c):
40-
c.run("isort --profile=black --check-only .")
38+
c.run("isort --check-only .")
4139
c.run("black --check .")
4240
c.run('echo "one pass for show-stopper syntax errors or undefined names"')
4341
c.run("flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics")
4442
c.run('echo "one pass for small stylistic things"')
45-
c.run(f"flake8 . --count --max-line-length={MAX_LINE_LENGTH} --statistics")
43+
c.run("flake8 . --count --statistics")
4644

4745

4846
@task
4947
def lint(c):
50-
c.run("isort --profile=black .")
48+
c.run("isort .")
5149
c.run("black .")
5250
c.run("flake8 .")
5351

tests/test_libzim_creator.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
import libzim.writer
1414
from libzim.reader import Archive
15+
from libzim.search import Query, Searcher
1516
from libzim.suggestion import SuggestionSearcher
1617
from libzim.writer import (
1718
Blob,
@@ -232,15 +233,17 @@ def test_creator_clustersize(fpath, cluster_size, lipsum_item):
232233
],
233234
)
234235
def test_creator_indexing(fpath, lipsum_item, indexing, language, expected):
235-
fpath = "lolo.zim"
236236
with Creator(fpath).config_indexing(indexing, language) as c:
237237
c.add_item(lipsum_item)
238238

239239
zim = Archive(fpath)
240240
assert zim.has_fulltext_index == indexing
241241

242-
# upstream bug https://github.com/openzim/libzim/issues/481
243-
# assert zim.get_estimated_search_results_count("standard") == expected
242+
if indexing:
243+
query = Query().set_query("standard")
244+
searcher = Searcher(zim)
245+
search = searcher.search(query)
246+
assert search.getEstimatedMatches() == expected
244247

245248

246249
@pytest.mark.parametrize("nb_workers", [1, 2, 3, 5])

0 commit comments

Comments
 (0)