MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_empty_value

Method test_empty_value

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 9

getattrFunction · 0.85
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