(self)
| 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) |
nothing calls this directly
no test coverage detected