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

Method test_empty_value

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

Source from the content-addressed store, hash-verified

114 f.close()
115
116 def test_empty_value(self):
117 if getattr(dbm._defaultmod, 'library', None) == 'Berkeley DB':
118 self.skipTest("Berkeley DB doesn't distinguish the empty value "
119 "from the absent one")
120 f = dbm.open(_fname, 'c')
121 self.assertEqual(f.keys(), [])
122 f[b'empty'] = b''
123 self.assertEqual(f.keys(), [b'empty'])
124 self.assertIn(b'empty', f)
125 self.assertEqual(f[b'empty'], b'')
126 self.assertEqual(f.get(b'empty'), b'')
127 self.assertEqual(f.setdefault(b'empty'), b'')
128 f.close()
129
130 def test_anydbm_access(self):
131 self.init_db()

Callers

nothing calls this directly

Calls 8

skipTestMethod · 0.80
assertInMethod · 0.80
openMethod · 0.45
assertEqualMethod · 0.45
keysMethod · 0.45
getMethod · 0.45
setdefaultMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected