From: Petri Lehtinen Date: Sat, 23 Feb 2013 22:12:35 +0000 (+0100) Subject: Revert "Issue #16121: Fix line number accounting in shlex" X-Git-Tag: v3.3.1rc1~131 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e766c742c1f006c08fa0f48ee43b4edb599a81c9;p=python Revert "Issue #16121: Fix line number accounting in shlex" --- e766c742c1f006c08fa0f48ee43b4edb599a81c9 diff --cc Lib/test/test_shlex.py index 5f7b68f783,25e4b6df6c..d2809aede2 --- a/Lib/test/test_shlex.py +++ b/Lib/test/test_shlex.py @@@ -174,30 -173,6 +174,21 @@@ class ShlexTest(unittest.TestCase) "%s: %s != %s" % (self.data[i][0], l, self.data[i][1:])) + def testQuote(self): + safeunquoted = string.ascii_letters + string.digits + '@%_-+=:,./' + unicode_sample = '\xe9\xe0\xdf' # e + acute accent, a + grave, sharp s + unsafe = '"`$\\!' + unicode_sample + + self.assertEqual(shlex.quote(''), "''") + self.assertEqual(shlex.quote(safeunquoted), safeunquoted) + self.assertEqual(shlex.quote('test file name'), "'test file name'") + for u in unsafe: + self.assertEqual(shlex.quote('test%sname' % u), + "'test%sname'" % u) + for u in unsafe: + self.assertEqual(shlex.quote("test%s'name'" % u), + "'test%s'\"'\"'name'\"'\"''" % u) + - def testLineNumbers(self): - data = '"a \n b \n c"\n"x"\n"y"' - for is_posix in (True, False): - s = shlex.shlex(data, posix=is_posix) - for i in (1, 4, 5): - s.read_token() - self.assertEqual(s.lineno, i) - - # Allow this test to be used with old shlex.py if not getattr(shlex, "split", None): for methname in dir(ShlexTest):