Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added test to fail on memcached type #134

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions test_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,23 @@ def test_20_jinja2ext_cache(self):
k = make_template_fragment_key("fragment4", vary_on=["fragment5"])
assert self.cache.get(k) == somevar
assert output == somevar

def test_21_memoized_custom_repr(self):
with self.app.test_request_context():
class SlowClass(object):
@self.cache.memoize()
def slow_func(self, a, b):
return a + b, random.randrange(0, 100000)

def __repr__(self):
return "A SLOW CLASS"

sc = SlowClass()
result_a, rand_a = sc.slow_func(1, 2)
assert(result_a == 3)
result_b, rand_b = sc.slow_func(1, 2)
assert(result_b == 3)
assert(rand_a == rand_b)


if 'TRAVIS' in os.environ:
Expand Down