예제 #1
0
#!/usr/bin/env python3
""" Main module"""

from exercise import Cache, replay

cache = Cache()

cache.store("foo")
cache.store("bar")
cache.store(42)
cache.store(32)

replay(cache.store)
예제 #2
0
#!/usr/bin/env python3
"""
Testing Cache class.
"""
from exercise import Cache

cache = Cache()

TEST_CASES = {b"foo": None, 123: int, "bar": lambda d: d.decode("utf-8")}

for value, fn in TEST_CASES.items():
    key = cache.store(value)
    assert cache.get(key, fn=fn) == value
#!/usr/bin/env python3

from exercise import Cache

cache = Cache()

print(cache.store("Goodbye"))