Ejemplo n.º 1
0
 def test_friendly_repr(self):
     self.assertEqual(friendly_repr(1), '1')
     if PY2:
         self.assertEqual(friendly_repr('aaa'), "b'aaa'")
         self.assertEqual(friendly_repr(u'aaa'), "u'aaa'")
     else:
         self.assertEqual(friendly_repr('aaa'), "'aaa'")
Ejemplo n.º 2
0
 def _build_report_miss_msg(self, method_name, *args, **kwargs):
     return 'Miss cache method invocation: `{}.{}({})`'.format(
         self._model_class.__name__, method_name, ', '.join(
             filter(
                 None,
                 (', '.join(map(friendly_repr, list(args))) if args else '',
                  ', '.join('{}={}'.format(k, friendly_repr(v))
                            for k, v in sorted(iteritems(kwargs)))))))
Ejemplo n.º 3
0
 def __repr__(self):
     class_name = self.__class__.__name__
     return '{class_name}({kwargs})'.format(
         class_name=class_name,
         kwargs=', '.join('{}={}'.format(k, friendly_repr(getattr(self, k)))
                          for k in self.__ordered_field_attr_names__))