test_encoding.py 444 B

123456789101112131415161718
  1. from __future__ import absolute_import, unicode_literals
  2. from celery.utils import encoding
  3. class test_encoding:
  4. def test_safe_str(self):
  5. assert encoding.safe_str(object())
  6. assert encoding.safe_str('foo')
  7. def test_safe_repr(self):
  8. assert encoding.safe_repr(object())
  9. class foo(object):
  10. def __repr__(self):
  11. raise ValueError('foo')
  12. assert encoding.safe_repr(foo())