mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 19:19:32 +01:00
Added a few more test cases to testDQRepr and made it less fragile.
This commit is contained in:
parent
f9928ba41f
commit
f2bb968030
@ -99,15 +99,11 @@ class UtilsTest(unittest.TestCase):
|
|||||||
'%s was %s, not %s' % (name, soundex, key))
|
'%s was %s, not %s' % (name, soundex, key))
|
||||||
|
|
||||||
def testDQRepr(self):
|
def testDQRepr(self):
|
||||||
L = [('foo', '"foo"'),
|
L = ['foo', 'foo\'bar', 'foo"bar', '"', '\\', '', '\x00']
|
||||||
('foo\'bar', '"foo\'bar"'),
|
for s in L:
|
||||||
('foo"bar', '"foo\\"bar"'),
|
r = utils.dqrepr(s)
|
||||||
('"', '"\\""'),
|
self.assertEqual(s, eval(r), s)
|
||||||
('', '""'),
|
self.failUnless(r[0] == '"' and r[-1] == '"', s)
|
||||||
('\x00', '"\\x00"')]
|
|
||||||
for (s, r) in L:
|
|
||||||
self.assertEqual(r, utils.dqrepr(s))
|
|
||||||
self.assertEqual(s, eval(utils.dqrepr(s)))
|
|
||||||
|
|
||||||
def testPerlReToPythonRe(self):
|
def testPerlReToPythonRe(self):
|
||||||
r = utils.perlReToPythonRe('m/foo/')
|
r = utils.perlReToPythonRe('m/foo/')
|
||||||
|
Loading…
Reference in New Issue
Block a user