Commits

Mikhail Korobov  committed b8dfeeb

Test for encoding error for objects with non-unicode __repr__

  • Participants
  • Parent commits 8b285f7

Comments (0)

Files changed (1)

File cache_utils/tests.py

     def bar(cls, x):
         pass
 
+class Store(object):
+    """ Class for encoding error test """
+    def __unicode__(self):
+        return u'Вася'
+    def __repr__(self):
+        return u'Вася'.encode('utf8')
+
+
 class FuncTypeTest(TestCase):
     def assertFuncType(self, func, tp):
         self.assertEqual(_func_type(func), tp)
             return utf8_array
         func([u'Василий'.encode('utf8')], u'Петрович'.encode('utf8'))
 
+    def test_utf8_repr(self):
+        @cached(60)
+        def func(param):
+            return param
+
+        func(Store())
+