예제 #1
0
def test_delete():
    client = MockMemcacheClient()

    client.add(b"k", 2)
    tools.assert_equal(client.get(b"k"), 2)

    client.delete(b"k")
    tools.assert_equal(client.get(b"k"), None)
예제 #2
0
def test_get_set_non_ascii_value():
    client = MockMemcacheClient()
    assert client.get(b"hello") is None

    # This is the value of msgpack.packb('non_ascii')
    non_ascii_str = b"\xa9non_ascii"
    client.set(b"hello", non_ascii_str)
    assert client.get(b"hello") == non_ascii_str
예제 #3
0
def test_add():
    client = MockMemcacheClient()

    client.add(b"k", 2)
    tools.assert_equal(client.get(b"k"), 2)

    client.add(b"k", 25)
    tools.assert_equal(client.get(b"k"), 2)
예제 #4
0
def test_delete():
    client = MockMemcacheClient()

    client.add(b"k", 2)
    assert client.get(b"k") == 2

    client.delete(b"k")
    assert client.get(b"k") is None
예제 #5
0
def test_delete():
    client = MockMemcacheClient()

    client.add("k", 2)
    tools.assert_equal(client.get("k"), 2)

    client.delete("k")
    tools.assert_equal(client.get("k"), None)
예제 #6
0
def test_delete():
    client = MockMemcacheClient()

    client.add(b"k", 2)
    assert client.get(b"k") == 2

    client.delete(b"k")
    assert client.get(b"k") is None
예제 #7
0
def test_add():
    client = MockMemcacheClient()

    client.add(b"k", 2)
    assert client.get(b"k") == 2

    client.add(b"k", 25)
    assert client.get(b"k") == 2
예제 #8
0
def test_get_set_non_ascii_value():
    client = MockMemcacheClient()
    assert client.get(b"hello") is None

    # This is the value of msgpack.packb('non_ascii')
    non_ascii_str = b'\xa9non_ascii'
    client.set(b"hello", non_ascii_str)
    assert client.get(b"hello") == non_ascii_str
예제 #9
0
def test_add():
    client = MockMemcacheClient()

    client.add(b"k", 2)
    assert client.get(b"k") == 2

    client.add(b"k", 25)
    assert client.get(b"k") == 2
예제 #10
0
def test_add():
    client = MockMemcacheClient()

    client.add("k", 2)
    tools.assert_equal(client.get("k"), 2)

    client.add("k", 25)
    tools.assert_equal(client.get("k"), 2)
예제 #11
0
def test_incr_decr():
    client = MockMemcacheClient()

    client.add(b"k", 2)

    client.incr(b"k", 4)
    tools.assert_equal(client.get(b"k"), 6)

    client.decr(b"k", 2)
    tools.assert_equal(client.get(b"k"), 4)
예제 #12
0
def test_incr_decr():
    client = MockMemcacheClient()

    client.add(b"k", 2)

    client.incr(b"k", 4)
    assert client.get(b"k") == 6

    client.decr(b"k", 2)
    assert client.get(b"k") == 4
예제 #13
0
def test_incr_decr():
    client = MockMemcacheClient()

    client.add(b"k", 2)

    client.incr(b"k", 4)
    assert client.get(b"k") == 6

    client.decr(b"k", 2)
    assert client.get(b"k") == 4
예제 #14
0
def test_incr_decr():
    client = MockMemcacheClient()

    client.add("k", 2)

    client.incr("k", 4)
    tools.assert_equal(client.get("k"), 6)

    client.decr("k", 2)
    tools.assert_equal(client.get("k"), 4)
예제 #15
0
def test_prepand_append():
    client = MockMemcacheClient()

    client.set(b"k", '1')
    client.append(b"k", 'a')
    client.prepend(b"k", 'p')
    assert client.get(b"k") == b'p1a'
예제 #16
0
def test_prepand_append():
    client = MockMemcacheClient()

    client.set(b"k", "1")
    client.append(b"k", "a")
    client.prepend(b"k", "p")
    assert client.get(b"k") == b"p1a"
예제 #17
0
def test_get_set():
    client = MockMemcacheClient()
    assert client.get(b"hello") is None

    client.set(b"hello", 12)
    assert client.get(b"hello") == 12
예제 #18
0
def test_get_set():
    client = MockMemcacheClient()
    assert client.get(b"hello") is None

    client.set(b"hello", 12)
    assert client.get(b"hello") == 12
예제 #19
0
def test_get_set():
    client = MockMemcacheClient()
    tools.assert_equal(client.get("hello"), None)

    client.set("hello", 12)
    tools.assert_equal(client.get("hello"), 12)
예제 #20
0
def test_get_set():
    client = MockMemcacheClient()
    tools.assert_equal(client.get(b"hello"), None)

    client.set(b"hello", 12)
    tools.assert_equal(client.get(b"hello"), 12)