Ejemplo n.º 1
0
 def test_buggy_repr(self):
     class eh_ix(object):
         def __repr__(self):
             return 1 + "2"
     self.assertRaises(Exception, repr, eh_ix())
     sr = util.safe_repr(eh_ix())
     sr = re.sub('[A-F0-9]{4,}', 'ADDRESS', sr)
     sr = re.sub(r'__main__|trac\.util\.tests', 'MODULE', sr)
     self.assertEqual("<MODULE.eh_ix object at 0xADDRESS "
                      "(repr() error: TypeError: unsupported operand "
                      "type(s) for +: 'int' and 'str')>", sr)
Ejemplo n.º 2
0
 def test_buggy_repr(self):
     class eh_ix(object):
         def __repr__(self):
             return 1 + "2"
     self.assertRaises(Exception, repr, eh_ix())
     sr = util.safe_repr(eh_ix())
     sr = re.sub('[A-F0-9]{4,}', 'ADDRESS', sr)
     sr = re.sub(r'__main__|trac\.util\.tests(\.__init__)?', 'MODULE', sr)
     self.assertEqual("<MODULE.eh_ix object at 0xADDRESS "
                      "(repr() error: TypeError: unsupported operand "
                      "type(s) for +: 'int' and 'str')>", sr)
Ejemplo n.º 3
0
 def test_normal_repr(self):
     for x in ([1, 2, 3], "été", u"été"):
         self.assertEqual(repr(x), util.safe_repr(x))
Ejemplo n.º 4
0
 def test_normal_repr(self):
     for x in ([1, 2, 3], "été", u"été"):
         self.assertEqual(repr(x), util.safe_repr(x))