(self)
| 37 | assert cache.values() == [] |
| 38 | |
| 39 | def test_pickleable(self): |
| 40 | cache = LRUCache(2) |
| 41 | cache["foo"] = 42 |
| 42 | cache["bar"] = 23 |
| 43 | cache["foo"] |
| 44 | |
| 45 | for protocol in range(3): |
| 46 | copy = pickle.loads(pickle.dumps(cache, protocol)) |
| 47 | assert copy.capacity == cache.capacity |
| 48 | assert copy._mapping == cache._mapping |
| 49 | assert copy._queue == cache._queue |
| 50 | |
| 51 | @pytest.mark.parametrize("copy_func", [LRUCache.copy, shallow_copy]) |
| 52 | def test_copy(self, copy_func): |