def test_delete(): test_obj = PersistentLRUCache(directory=directory) test_obj.write("some_key", "42") test_obj.write("42", "some_key") test_obj.delete("some_key") test_obj.delete("non_existant_key") test_obj.delete("42") assert_raises( KeyError, test_obj.get_value, ("42") ) assert_raises( KeyError, test_obj.get_value, ("some_key") ) assert not test_obj.exists("42") assert not test_obj.exists("some_key")
def test_exists(): test_obj = PersistentLRUCache(directory=directory) assert not test_obj.exists("some_key") test_obj.write("some_key", "42") assert test_obj.exists("some_key") assert not test_obj.exists("some_other_key")