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