| 104 | assert cache.hits == 2 |
| 105 | |
| 106 | def test_meta(self, cache: RepositoryCache): |
| 107 | # Same as test_simple, but not reading the chunk data (metadata only). |
| 108 | # Single get()s are not cached, since they are used for unique objects like archives. |
| 109 | assert pdchunk(cache.get(H(1), read_data=False)) == b"" |
| 110 | assert cache.misses == 1 |
| 111 | assert cache.hits == 0 |
| 112 | |
| 113 | assert [pdchunk(ch) for ch in cache.get_many([H(1)], read_data=False)] == [b""] |
| 114 | assert cache.misses == 2 |
| 115 | assert cache.hits == 0 |
| 116 | |
| 117 | assert [pdchunk(ch) for ch in cache.get_many([H(1)], read_data=False)] == [b""] |
| 118 | assert cache.misses == 2 |
| 119 | assert cache.hits == 1 |
| 120 | |
| 121 | assert pdchunk(cache.get(H(1), read_data=False)) == b"" |
| 122 | assert cache.misses == 2 |
| 123 | assert cache.hits == 2 |
| 124 | |
| 125 | def test_mixed(self, cache: RepositoryCache): |
| 126 | assert [pdchunk(ch) for ch in cache.get_many([H(1)], read_data=False)] == [b""] |