def test_context_set_contains_get(spf): context = ContextDict(spf, None) context.set("t1", "hello world") assert "t1" in context assert context.get("t1") == "hello world" exceptions = [] try: context.set("__weakref__", set()) except ValueError as e: exceptions.append(e) finally: assert len(exceptions) > 0
def test_context_del(spf): context = ContextDict(spf, None) context.set(1, "1") context.set(2, "2") context.set(3, "3") context.set(4, "4") del context[1] one = context.get(1, None) assert one is None exceptions = [] try: #TODO: How do you even delete a slice? del context[2:4] except Exception as e: exceptions.append(e) finally: assert len(exceptions) > 0