def test_push_unknown(): ctx = Context() needle = 'xyzzy' assert needle not in _default_context.keys() with pytest.raises(KeyError): ctx.push(**{needle: Nothing}) with pytest.raises(RuntimeError): ctx.pop()
def test_push_known(): ctx = Context() needle = _default_context.keys()[0] assert needle in ctx assert ctx[needle] is not Nothing ctx.push(**{needle.encode('ascii'): Nothing}) assert ctx[needle] is Nothing ctx.pop() assert ctx[needle] is not Nothing
def test_push_known(): ctx = Context() needle = _default_context.keys()[0] assert needle in ctx assert ctx[needle] is not Nothing ctx.push(**{needle.encode('ascii'): Nothing}) assert ctx[needle] is Nothing ctx.pop() assert ctx[needle] is not Nothing
def test_push_known(): ctx = Context() needle = list(_default_context.keys())[0] assert needle in ctx assert ctx[needle] is not Nothing ctx.push(**{needle: Nothing}) assert ctx[needle] is Nothing ctx.pop() assert ctx[needle] is not Nothing
def test_push_known(): ctx = Context() needle = list(_default_context.keys())[0] assert needle in ctx assert ctx[needle] is not Nothing ctx.push(**{needle: Nothing}) assert ctx[needle] is Nothing ctx.pop() assert ctx[needle] is not Nothing
def test_stack_plain_push_pop(): ctx = Context() needle, initial_value = _default_context.items()[0] assert ctx[needle] == initial_value ctx.push() assert ctx[needle] == initial_value ctx[needle] = Nothing assert ctx[needle] is Nothing ctx.pop() assert ctx[needle] is not Nothing assert ctx[needle] == initial_value assert_raises(RuntimeError, ctx.pop)
def test_stack_plain_push_pop(): ctx = Context() needle, initial_value = _default_context.items()[0] assert ctx[needle] == initial_value ctx.push() assert ctx[needle] == initial_value ctx[needle] = Nothing assert ctx[needle] is Nothing ctx.pop() assert ctx[needle] is not Nothing assert ctx[needle] == initial_value assert_raises(RuntimeError, ctx.pop)
def test_default_minimum_stack(): ctx = Context() with pytest.raises(RuntimeError): ctx.pop()