mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
[3.14] gh-138804: Check type in shlex.quote (GH-138809) (#138846)
Co-authored-by: Christoph Walcher <christoph-wa@gmx.de>
This commit is contained in:
parent
fbfbfdf33c
commit
18dfc1d6c4
3 changed files with 9 additions and 0 deletions
|
|
@ -330,6 +330,7 @@ def testQuote(self):
|
|||
unsafe = '"`$\\!' + unicode_sample
|
||||
|
||||
self.assertEqual(shlex.quote(''), "''")
|
||||
self.assertEqual(shlex.quote(None), "''")
|
||||
self.assertEqual(shlex.quote(safeunquoted), safeunquoted)
|
||||
self.assertEqual(shlex.quote('test file name'), "'test file name'")
|
||||
for u in unsafe:
|
||||
|
|
@ -338,6 +339,8 @@ def testQuote(self):
|
|||
for u in unsafe:
|
||||
self.assertEqual(shlex.quote("test%s'name'" % u),
|
||||
"'test%s'\"'\"'name'\"'\"''" % u)
|
||||
self.assertRaises(TypeError, shlex.quote, 42)
|
||||
self.assertRaises(TypeError, shlex.quote, b"abc")
|
||||
|
||||
def testJoin(self):
|
||||
for split_command, command in [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue