test_encoding.py 379 B

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