Commit 59720b2f authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

Test unicode args and return values with memoize funcs

parent db86e6f7
......@@ -5,6 +5,7 @@
# Author: Paul McCarthy <pauldmccarthy@gmail.com>
#
import six
import numpy as np
......@@ -24,7 +25,6 @@ def test_memoize():
memoized = memoize.memoize(thefunc)
# No args
for i in range(5):
assert memoized() == 0
......@@ -42,6 +42,13 @@ def test_memoize():
assert memoized(value=i) == i * 5
assert timesCalled[0] == 6
# Unicode arg
s = six.u('\u25B2')
assert memoized(s) == s * 5
assert timesCalled[0] == 7
assert memoized(s) == s * 5
assert timesCalled[0] == 7
def test_memoizeMD5():
timesCalled = [0]
......@@ -71,6 +78,13 @@ def test_memoizeMD5():
assert memoized(value=i) == i * 5
assert timesCalled[0] == 6
# Unicode arg (and return value)
s = six.u('\u25B2')
assert memoized(s) == s * 5
assert timesCalled[0] == 7
assert memoized(s) == s * 5
assert timesCalled[0] == 7
def test_skipUnchanged():
"""
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment