blob: 46f38e6ac5cec0bcf3cfac87f29a18f4da13c39b [file] [log] [blame]
koder aka kdanilov70227062016-11-26 23:23:21 +02001import shutil
2import tempfile
3import contextlib
4
5
6from oktest import ok, main, test
7
8
9from wally.storage import make_storage
10
11
12@contextlib.contextmanager
13def in_temp_dir():
14 dname = tempfile.mkdtemp()
15 try:
16 yield dname
17 finally:
18 shutil.rmtree(dname)
19
20
21def test_basic():
22 with in_temp_dir() as root:
23 values = {
24 "int": 1,
25 "str/1": "test",
26 "bytes/2": b"test",
27 "none/s/1": None,
28 "bool/xx/1/2/1": None,
29 "float/s/1": 1.234,
30 "list": [1, 2, "3"],
31 "dict": {1: 3, "2": "4", "1.2": 1.3}
32 }
33
34 with make_storage(root, existing=False) as storage:
35 for path, val in values.items():
36 storage[path] = val
37
38
39 with make_storage(root, existing=True) as storage:
40 for path, val in values.items():
41 ok(storage[path]) == val
42
43
44def test_large_arrays():
45 pass
46
47
48def test_array_append():
49 pass
50
51
52def test_performance():
53 pass