Skip to content

Commit be834ab

Browse files
committed
Check for existence of files during testing
1 parent 7c41468 commit be834ab

2 files changed

Lines changed: 10 additions & 14 deletions

File tree

tests/test_map.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,12 @@
88
TEST_ITEMS = [(u"möö", 1), (u"bar", 2), (u"baz", 1337), (u"foo", 2**16)]
99

1010

11-
def do_build(path=None, keys=TEST_ITEMS, sorted_=True):
11+
def do_build(path=None, items=TEST_ITEMS, sorted_=True):
1212
if sorted_:
13-
it = sorted(keys)
13+
it = sorted(items)
1414
else:
15-
it = keys
16-
if path:
17-
with Map.build(path) as builder:
18-
for key, val in it:
19-
builder.insert(key, val)
20-
else:
21-
return Map.from_iter(it)
15+
it = items
16+
return Map.from_iter(it=it, path=path)
2217

2318

2419
@pytest.fixture
@@ -27,8 +22,9 @@ def fst_map():
2722

2823

2924
def test_build(tmpdir):
30-
fst_path = str(tmpdir.join('test.fst'))
31-
do_build(fst_path)
25+
fst_path = tmpdir.join('test.fst')
26+
do_build(str(fst_path))
27+
assert fst_path.exists()
3228

3329

3430
def test_build_outoforder(tmpdir):

tests/test_set.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ def fst_set(tmpdir):
2222

2323

2424
def test_build(tmpdir):
25-
fst_path = str(tmpdir.join('test.fst'))
26-
do_build(fst_path)
27-
assert True
25+
fst_path = tmpdir.join('test.fst')
26+
do_build(str(fst_path))
27+
assert fst_path.exists()
2828

2929

3030
def test_build_outoforder(tmpdir):

0 commit comments

Comments
 (0)