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

Method test_close

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 5

assertEqualMethod · 0.95
closeMethod · 0.95
assertRaisesMethod · 0.95
failMethod · 0.95
lenFunction · 0.85

Tested by

no test coverage detected