def handshake_complete(self):
     achievements_cache_ = self.persistent_cache.get("achievements")
     if achievements_cache_ is not None:
         try:
             achievements_cache_ = json.loads(achievements_cache_)
             self._achievements_cache = achievements_cache.from_dict(achievements_cache_)
         except Exception:
             logging.exception("Can not deserialize achievements cache")
def test_from_dict(dict_, cache):
    assert list(from_dict(dict_)) == list(cache)
def test_from_dict_empty(dict_, cache):
    assert list(from_dict({})) == list(Cache())
def test_from_dict_error(dict_):
    with pytest.raises(ValueError):
        from_dict(dict_)