def things(self, query): return self.query_results.get(dicthash(query), [])
def add_query(self, query, result): self.query_results[dicthash(query)] = result
def test_dicthash(): assert dicthash({}) == dicthash({}) assert dicthash({"a": 1}) == dicthash({"a": 1}) assert dicthash({"a": 1, "b": 2}) == dicthash({"b": 2, "a": 1}) assert dicthash({}) != dicthash({"a": 1}) assert dicthash({"b": 1}) != dicthash({"a": 1})