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

Method test_empty_value

Lib/test/test_dbm_ndbm.py:40–52  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

38 self.d.close()
39
40 def test_empty_value(self):
41 if dbm.ndbm.library == 'Berkeley DB':
42 self.skipTest("Berkeley DB doesn't distinguish the empty value "
43 "from the absent one")
44 self.d = dbm.ndbm.open(self.filename, 'c')
45 self.assertEqual(self.d.keys(), [])
46 self.d['empty'] = ''
47 self.assertEqual(self.d.keys(), [b'empty'])
48 self.assertIn(b'empty', self.d)
49 self.assertEqual(self.d[b'empty'], b'')
50 self.assertEqual(self.d.get(b'empty'), b'')
51 self.assertEqual(self.d.setdefault(b'empty'), b'')
52 self.d.close()
53
54 def test_modes(self):
55 for mode in ['r', 'rw', 'w', 'n']:

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