From f2bb96803004a0865604f1af0750c179a92a2c9d Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Sun, 17 Aug 2003 06:26:50 +0000 Subject: [PATCH] Added a few more test cases to testDQRepr and made it less fragile. --- test/test_utils.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/test/test_utils.py b/test/test_utils.py index f461dd64d..000521a1d 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -99,16 +99,12 @@ class UtilsTest(unittest.TestCase): '%s was %s, not %s' % (name, soundex, key)) def testDQRepr(self): - L = [('foo', '"foo"'), - ('foo\'bar', '"foo\'bar"'), - ('foo"bar', '"foo\\"bar"'), - ('"', '"\\""'), - ('', '""'), - ('\x00', '"\\x00"')] - for (s, r) in L: - self.assertEqual(r, utils.dqrepr(s)) - self.assertEqual(s, eval(utils.dqrepr(s))) - + L = ['foo', 'foo\'bar', 'foo"bar', '"', '\\', '', '\x00'] + for s in L: + r = utils.dqrepr(s) + self.assertEqual(s, eval(r), s) + self.failUnless(r[0] == '"' and r[-1] == '"', s) + def testPerlReToPythonRe(self): r = utils.perlReToPythonRe('m/foo/') self.failUnless(r.search('foo'))