def test_read_write_unknown(): ctx = Context() needle = u'xyzzy' assert needle not in _default_context.keys() assert needle not in ctx assert_raises(KeyError, lambda: ctx[needle]) assert_raises(KeyError, ctx.__setitem__, needle, Nothing)
def test_read_write_known(): ctx = Context() needle = _default_context.keys()[0] assert needle in ctx assert ctx[needle] is not Nothing ctx[needle] = Nothing assert ctx[needle] is Nothing
def test_read_write_known(): ctx = Context() needle = _default_context.keys()[0] assert needle in ctx assert ctx[needle] is not Nothing ctx[needle] = Nothing assert ctx[needle] is Nothing
def test_push_unknown(): ctx = Context() needle = 'xyzzy' assert needle not in _default_context.keys() assert_raises(KeyError, ctx.push, **{needle: Nothing}) assert_raises(RuntimeError, ctx.pop)
def test_read_write_unknown(): ctx = Context() needle = 'xyzzy' assert needle not in _default_context.keys() assert needle not in ctx assert_raises(KeyError, lambda: ctx[needle]) assert_raises(KeyError, ctx.__setitem__, needle, Nothing)
def test_update_unknown(): ctx = Context() assert u'xyzzy' not in _default_context.keys() with pytest.raises(KeyError): ctx.update(xyzzy=123) assert u'xyzzy' not in ctx
def test_push_unknown(): ctx = Context() needle = u'xyzzy' needle_attribute = 'xyzzy' # native text type assert needle not in _default_context.keys() assert_raises(KeyError, ctx.push, **{needle_attribute: Nothing}) assert_raises(RuntimeError, ctx.pop)
def test_read_write_unknown(): ctx = Context() needle = 'xyzzy' assert needle not in _default_context.keys() assert needle not in ctx with pytest.raises(KeyError): ctx[needle]() with pytest.raises(KeyError): ctx.__setitem__(needle, Nothing)
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 = 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 = _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_update_known(): ctx = Context() known = _default_context.keys() sentinels = [object(), object()] iterable = [(known[0], sentinels[0])] kwargs = {known[1].encode('ascii'): sentinels[1]} ctx.update(iterable, **kwargs) assert ctx[known[0]] is sentinels[0] assert ctx[known[1]] is sentinels[1] ctx = Context() ctx.update(iterable) assert ctx[known[0]] is sentinels[0] ctx = Context() ctx.update(**kwargs) assert ctx[known[1]] is sentinels[1]
def test_update_known(): ctx = Context() known = _default_context.keys() sentinels = [object(), object()] iterable = [(known[0], sentinels[0])] kwargs = {known[1].encode('ascii'): sentinels[1]} ctx.update(iterable, **kwargs) assert ctx[known[0]] is sentinels[0] assert ctx[known[1]] is sentinels[1] ctx = Context() ctx.update(iterable) assert ctx[known[0]] is sentinels[0] ctx = Context() ctx.update(**kwargs) assert ctx[known[1]] is sentinels[1]
def test_update_unknown(): ctx = Context() assert u'xyzzy' not in _default_context.keys() assert_raises(KeyError, ctx.update, xyzzy=123) assert u'xyzzy' not in ctx
def test_update_unknown(): ctx = Context() assert u'xyzzy' not in _default_context.keys() assert_raises(KeyError, ctx.update, xyzzy=123) assert u'xyzzy' not in ctx