예제 #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)
예제 #2
0
파일: __init__.py 프로젝트: rwbaumg/trac
 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)
예제 #3
0
 def test_normal_repr(self):
     for x in ([1, 2, 3], "été", u"été"):
         self.assertEqual(repr(x), util.safe_repr(x))
예제 #4
0
 def test_normal_repr(self):
     for x in ([1, 2, 3], "été", u"été"):
         self.assertEqual(repr(x), util.safe_repr(x))