summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_anydbm.py
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2007-08-07 07:15:50 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2007-08-07 07:15:50 (GMT)
commitca8dd9182e60bc4411a5ed9b679caf188af05b6a (patch)
treea1a8cfa628d2426f64ac77fcad2b62e9fcb84b4d /Lib/test/test_anydbm.py
parentf9b95d4dda8ced9e1179ff54757ff27bb6abd6f3 (diff)
downloadcpython-ca8dd9182e60bc4411a5ed9b679caf188af05b6a.zip
cpython-ca8dd9182e60bc4411a5ed9b679caf188af05b6a.tar.gz
cpython-ca8dd9182e60bc4411a5ed9b679caf188af05b6a.tar.bz2
Fix test case by converting dbm keys to bytes.
Diffstat (limited to 'Lib/test/test_anydbm.py')
-rw-r--r--Lib/test/test_anydbm.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/Lib/test/test_anydbm.py b/Lib/test/test_anydbm.py
index b396d6f..367360f 100644
--- a/Lib/test/test_anydbm.py
+++ b/Lib/test/test_anydbm.py
@@ -21,13 +21,13 @@ def _delete_files():
pass
class AnyDBMTestCase(unittest.TestCase):
- _dict = {str8('0'): b'',
- str8('a'): b'Python:',
- str8('b'): b'Programming',
- str8('c'): b'the',
- str8('d'): b'way',
- str8('f'): b'Guido',
- str8('g'): b'intended',
+ _dict = {'0': b'',
+ 'a': b'Python:',
+ 'b': b'Programming',
+ 'c': b'the',
+ 'd': b'way',
+ 'f': b'Guido',
+ 'g': b'intended',
}
def __init__(self, *args):
@@ -37,14 +37,14 @@ class AnyDBMTestCase(unittest.TestCase):
f = anydbm.open(_fname, 'c')
self.assertEqual(list(f.keys()), [])
for key in self._dict:
- f[key] = self._dict[key]
+ f[key.encode("ascii")] = self._dict[key]
self.read_helper(f)
f.close()
def test_anydbm_modification(self):
self.init_db()
f = anydbm.open(_fname, 'c')
- self._dict[str8('g')] = f[str8('g')] = b"indented"
+ self._dict['g'] = f[b'g'] = b"indented"
self.read_helper(f)
f.close()
@@ -63,16 +63,16 @@ class AnyDBMTestCase(unittest.TestCase):
def read_helper(self, f):
keys = self.keys_helper(f)
for key in self._dict:
- self.assertEqual(self._dict[key], f[key])
+ self.assertEqual(self._dict[key], f[key.encode("ascii")])
def init_db(self):
f = anydbm.open(_fname, 'n')
for k in self._dict:
- f[k] = self._dict[k]
+ f[k.encode("ascii")] = self._dict[k]
f.close()
def keys_helper(self, f):
- keys = sorted(f.keys())
+ keys = sorted(k.decode("ascii") for k in f.keys())
dkeys = sorted(self._dict.keys())
self.assertEqual(keys, dkeys)
return keys