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

Method test_close

Lib/test/test_shelve.py:50–63  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

48 fn = os.path.join(os_helper.TESTFN, "shelftemp.db")
49
50 def test_close(self):
51 d1 = {}
52 s = shelve.Shelf(d1, protocol=2, writeback=False)
53 s['key1'] = [1,2,3,4]
54 self.assertEqual(s['key1'], [1,2,3,4])
55 self.assertEqual(len(s), 1)
56 s.close()
57 self.assertRaises(ValueError, len, s)
58 try:
59 s['key1']
60 except ValueError:
61 pass
62 else:
63 self.fail('Closed shelf should not find a key')
64
65 def test_open_template(self, filename=None, protocol=None):
66 os.mkdir(self.dirname)

Callers

nothing calls this directly

Calls 4

assertEqualMethod · 0.95
closeMethod · 0.95
assertRaisesMethod · 0.95
failMethod · 0.95

Tested by

no test coverage detected