From a134d8ff2a39e17550829c7ceab394a1b14eaece Mon Sep 17 00:00:00 2001 From: Sam Ruby Date: Fri, 25 Aug 2006 11:54:28 -0400 Subject: [PATCH] Use assertEqual when possible so that errors are easier to debug --- tests/test_reconstitute.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/test_reconstitute.py b/tests/test_reconstitute.py index d9b0cea..ecae6e7 100644 --- a/tests/test_reconstitute.py +++ b/tests/test_reconstitute.py @@ -8,6 +8,7 @@ testfiles = 'tests/data/reconstitute/%s.xml' class ReconstituteTest(unittest.TestCase): desc_re = re.compile("Description:\s*(.*?)\s*Expect:\s*(.*)\s*-->") + simple_re = re.compile("^(\S+) == (u?'[^']*'|\([0-9, ]+\))$") def eval(self, name): # read the test case @@ -27,7 +28,11 @@ class ReconstituteTest(unittest.TestCase): # verify the results results = feedparser.parse(work.getvalue().encode('utf-8')) self.assertFalse(results.bozo, 'xml is well formed') - self.assertTrue(eval(expect, results.entries[0]), expect) + if not self.simple_re.match(expect): + self.assertTrue(eval(expect, results.entries[0]), expect) + else: + lhs, rhs = self.simple_re.match(expect).groups() + self.assertEqual(eval(rhs), eval(lhs, results.entries[0])) # build a test method for each test file for testcase in glob.glob(testfiles % '*'):