Ejemplo n.º 1
0
 def test_find_name(self):
     class MyClass(object):
         pass
     obj = MyClass()
     obj2 = MyClass()
     self.assertEqual(find_name(obj, obj2), '')
     setattr(obj, 'foo', obj2)
     self.assertEqual(find_name(obj, obj2), 'foo')
Ejemplo n.º 2
0
 def test_find_name(self):
     class MyClass(object):
         pass
     obj = MyClass()
     obj2 = MyClass()
     self.assertEqual(find_name(obj, obj2), '')
     setattr(obj, 'foo', obj2)
     self.assertEqual(find_name(obj, obj2), 'foo')
Ejemplo n.º 3
0
 def raise_exception(self, msg, exception_class=Exception):
     """Raise an exception."""
     name = find_name(self._parent, self)
     self._parent.raise_exception("%s: %s" % (name, msg), exception_class)
Ejemplo n.º 4
0
 def raise_exception(self, msg, exception_class=Exception):
     """Raise an exception."""
     name = find_name(self._parent, self)
     self._parent.raise_exception("%s: %s" % (name, msg), exception_class)