]> granicus.if.org Git - python/commitdiff
Revert "Issue #16121: Fix line number accounting in shlex"
authorPetri Lehtinen <petri@digip.org>
Sat, 23 Feb 2013 22:12:35 +0000 (23:12 +0100)
committerPetri Lehtinen <petri@digip.org>
Sat, 23 Feb 2013 22:12:35 +0000 (23:12 +0100)
1  2 
Lib/shlex.py
Lib/test/test_shlex.py
Misc/ACKS
Misc/NEWS

diff --cc Lib/shlex.py
Simple merge
index 5f7b68f7830b0ff96eab280b1fc87803ceea9eea,25e4b6df6c5d2403c5d2f7b3431ffa03da663541..d2809aede230d696911946a8d238c807be447f9d
@@@ -174,30 -173,6 +174,21 @@@ class ShlexTest(unittest.TestCase)
                               "%s: %s != %s" %
                               (self.data[i][0], l, self.data[i][1:]))
  
-     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)
 +    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)
 +
  # Allow this test to be used with old shlex.py
  if not getattr(shlex, "split", None):
      for methname in dir(ShlexTest):
diff --cc Misc/ACKS
Simple merge
diff --cc Misc/NEWS
Simple merge