Method
test_get
test/test_collections.py:87–103
· test/test_collections.py::TestLRUContainer.test_get
(self)
Source from the content-addressed store, hash-verified
| 85 | d.pop(1, None) |
| 86 | |
| 87 | def test_get(self) -> None: |
| 88 | d: Container[int, bool | int] = Container(5) |
| 89 | |
| 90 | for i in range(5): |
| 91 | d[i] = True |
| 92 | |
| 93 | r = d.get(4) |
| 94 | assert r is True |
| 95 | |
| 96 | r = d.get(5) |
| 97 | assert r is None |
| 98 | |
| 99 | r = d.get(5, 42) |
| 100 | assert r == 42 |
| 101 | |
| 102 | with pytest.raises(KeyError): |
| 103 | d[5] |
| 104 | |
| 105 | def test_disposal(self) -> None: |
| 106 | evicted_items: list[int] = [] |
Callers
nothing calls this directly
Tested by
no test coverage detected