MCPcopy Index your code
hub / github.com/python/cpython / test_anydbm_read

Method test_anydbm_read

Lib/test/test_dbm.py:98–108  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

96 f.close()
97
98 def test_anydbm_read(self):
99 self.init_db()
100 f = dbm.open(_fname, 'r')
101 self.read_helper(f)
102 # get() works as in the dict interface
103 self.assertEqual(f.get(b'a'), self._dict['a'])
104 self.assertEqual(f.get(b'xxx', b'foo'), b'foo')
105 self.assertIsNone(f.get(b'xxx'))
106 with self.assertRaises(KeyError):
107 f[b'xxx']
108 f.close()
109
110 def test_anydbm_keys(self):
111 self.init_db()

Callers

nothing calls this directly

Calls 8

init_dbMethod · 0.95
read_helperMethod · 0.95
assertIsNoneMethod · 0.80
openMethod · 0.45
assertEqualMethod · 0.45
getMethod · 0.45
assertRaisesMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected