示例#1
0
def test_context_map_put_and_pop():
    map = ContextMap()
    obj = object()
    key = map.put(obj)
    assert isinstance(key, int)
    eq_(len(map), 1)
    eq_(map.pop(key), obj)
    eq_(len(map), 0)
示例#2
0
def test_context_map_pop_non_existent_key():
    map = ContextMap()
    key = 1000
    try:
        value = map.pop(key)
    except KeyError:
        pass
    else:
        raise AssertionError("context map had value %r for key %r" % (value, key))
示例#3
0
def test_context_map_pop_with_default():
    map = ContextMap()
    DEF = "default"
    eq_(map.pop(1000, "default"), "default")