diff options
Diffstat (limited to 'Lib/test/test_dbm_dumb.py')
-rw-r--r-- | Lib/test/test_dbm_dumb.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/test/test_dbm_dumb.py b/Lib/test/test_dbm_dumb.py index 21f29af..652a355 100644 --- a/Lib/test/test_dbm_dumb.py +++ b/Lib/test/test_dbm_dumb.py @@ -281,6 +281,21 @@ class DumbDBMTestCase(unittest.TestCase): self.assertEqual(sorted(f.keys()), sorted(self._dict)) f.close() # don't write + @unittest.skipUnless(support.TESTFN_NONASCII, + 'requires OS support of non-ASCII encodings') + def test_nonascii_filename(self): + filename = support.TESTFN_NONASCII + for suffix in ['.dir', '.dat', '.bak']: + self.addCleanup(support.unlink, filename + suffix) + with dumbdbm.open(filename, 'c') as db: + db[b'key'] = b'value' + self.assertTrue(os.path.exists(filename + '.dat')) + self.assertTrue(os.path.exists(filename + '.dir')) + with dumbdbm.open(filename, 'r') as db: + self.assertEqual(list(db.keys()), [b'key']) + self.assertTrue(b'key' in db) + self.assertEqual(db[b'key'], b'value') + def tearDown(self): _delete_files() |