def test_dispose(self):
        c = LRUCache(2, dispose=lambda f: f.close())
        f1 = TemporaryFile()
        f2 = TemporaryFile()
        f3 = TemporaryFile()
        c[1] = f1
        c[2] = f2
        assert not f2.closed
        c[3] = f3
        assert 1 not in c
        assert f1.closed
        assert 2 in c
        assert not f2.closed
        del c[2]
        assert 2 not in c
        assert f2.closed
        c.clear()
        assert c.items() == set()
        assert f3.closed
dataset/ETHPy150Open borgbackup/borg/borg/testsuite/lrucache.py/TestLRUCache.test_dispose/original