Debian Codegraph @

extra_tests/test_gdbm.py

raw symbols SCIP
1 import pytest
2 gdbm = pytest.importorskip('dbm.gnu')
3
4 def test_len(tmpdir):
5 path = str(tmpdir.join('test_gdbm_extra'))
6 g = gdbm.open(path, 'c')
7 g['abc'] = 'def'
8 assert len(g) == 1
9 g['bcd'] = 'efg'
10 assert len(g) == 2
11 del g['abc']
12 assert len(g) == 1
13
14 def test_unicode(tmpdir):
15 path = str(tmpdir.join('test_gdm_unicode'))
16 g = gdbm.open(path, 'c') # does not crash
17
18 def test_unicode_key(tmpdir):
19 path = str(tmpdir.join('test_unicode_key'))
20 g = gdbm.open(path, 'c')
21 g[u"äöú"] = "ãáß"
22 assert g[u"äöú"].decode("utf-8") == "ãáß"