mirror of
https://github.com/wassname/cachier.git
synced 2026-09-09 11:19:08 +08:00
Add stubs for redis and memory References #4 and references #6 Make default compatible with previous interface Now, the default is calculated dynamically to maintain previous behavior to default to pickle unless the ``mongetter`` argument is given. This makes it have the same behavior as before, so users aren't forced to change old code to use the ``backend`` argument Update docs Add tests
30 lines
720 B
Python
30 lines
720 B
Python
"""Testing the MongoDB core of cachier."""
|
|
|
|
from cachier import cachier
|
|
from cachier.core import MissingMongetter
|
|
|
|
|
|
def test_bad_name():
|
|
"""Test that the appropriate exception is thrown when an invalid backend is given."""
|
|
name = 'nope'
|
|
try:
|
|
@cachier(backend=name)
|
|
def func():
|
|
pass
|
|
except ValueError as e:
|
|
assert name in e.args[0]
|
|
else:
|
|
assert False
|
|
|
|
|
|
def test_missing_mongetter():
|
|
"""Test that the appropriate exception is thrown when forgetting to specify the mongetter."""
|
|
try:
|
|
@cachier(backend='mongo', mongetter=None)
|
|
def func():
|
|
pass
|
|
except MissingMongetter:
|
|
assert True
|
|
else:
|
|
assert False
|