(self)
| 80 | self.assertEqual(f[b'xxx'], b'foo') |
| 81 | |
| 82 | def test_dumbdbm_read(self): |
| 83 | self.init_db() |
| 84 | with contextlib.closing(dumbdbm.open(_fname, 'r')) as f: |
| 85 | self.read_helper(f) |
| 86 | with self.assertRaisesRegex(dumbdbm.error, |
| 87 | 'The database is opened for reading only'): |
| 88 | f[b'g'] = b'x' |
| 89 | with self.assertRaisesRegex(dumbdbm.error, |
| 90 | 'The database is opened for reading only'): |
| 91 | del f[b'a'] |
| 92 | # get() works as in the dict interface |
| 93 | self.assertEqual(f.get(b'a'), self._dict[b'a']) |
| 94 | self.assertEqual(f.get(b'xxx', b'foo'), b'foo') |
| 95 | self.assertIsNone(f.get(b'xxx')) |
| 96 | with self.assertRaises(KeyError): |
| 97 | f[b'xxx'] |
| 98 | |
| 99 | def test_dumbdbm_keys(self): |
| 100 | self.init_db() |
nothing calls this directly
no test coverage detected