(self)
| 148 | self.assertNotEqual(p1, p2) # Write creates new object in store |
| 149 | |
| 150 | def test_with(self): |
| 151 | d1 = {} |
| 152 | with shelve.Shelf(d1, protocol=2, writeback=False) as s: |
| 153 | s['key1'] = [1,2,3,4] |
| 154 | self.assertEqual(s['key1'], [1,2,3,4]) |
| 155 | self.assertEqual(len(s), 1) |
| 156 | self.assertRaises(ValueError, len, s) |
| 157 | try: |
| 158 | s['key1'] |
| 159 | except ValueError: |
| 160 | pass |
| 161 | else: |
| 162 | self.fail('Closed shelf should not find a key') |
| 163 | |
| 164 | def test_default_protocol(self): |
| 165 | with shelve.Shelf({}) as s: |
nothing calls this directly
no test coverage detected