| 46 | objs[i], after - before)) |
| 47 | |
| 48 | def test_record_gc(self): |
| 49 | elem = object() |
| 50 | mapping = {} |
| 51 | with self.checkref(mapping, elem): |
| 52 | r = Record(mapping, (elem,)) |
| 53 | del r |
| 54 | |
| 55 | key = 'spam' |
| 56 | val = int('101010') |
| 57 | mapping = {key: val} |
| 58 | with self.checkref(key, val): |
| 59 | r = Record(mapping, (0,)) |
| 60 | with self.assertRaises(RuntimeError): |
| 61 | r[key] |
| 62 | del r |
| 63 | |
| 64 | key = 'spam' |
| 65 | val = 'ham' |
| 66 | mapping = {key: val} |
| 67 | with self.checkref(key, val): |
| 68 | r = Record(mapping, (0,)) |
| 69 | with self.assertRaises(RuntimeError): |
| 70 | r[key] |
| 71 | del r |
| 72 | |
| 73 | def test_record_freelist_ok(self): |
| 74 | for _ in range(10000): |