MCPcopy Index your code
hub / github.com/python/cpython / testQuote

Method testQuote

Lib/test/test_shlex.py:327–343  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

325 self.assertEqual(list(s), ref)
326
327 def testQuote(self):
328 safeunquoted = string.ascii_letters + string.digits + '@%_-+=:,./'
329 unicode_sample = '\xe9\xe0\xdf' # e + acute accent, a + grave, sharp s
330 unsafe = '"`$\\!' + unicode_sample
331
332 self.assertEqual(shlex.quote(''), "''")
333 self.assertEqual(shlex.quote(None), "''")
334 self.assertEqual(shlex.quote(safeunquoted), safeunquoted)
335 self.assertEqual(shlex.quote('test file name'), "'test file name'")
336 for u in unsafe:
337 self.assertEqual(shlex.quote('test%sname' % u),
338 "'test%sname'" % u)
339 for u in unsafe:
340 self.assertEqual(shlex.quote("test%s'name'" % u),
341 "'test%s'\"'\"'name'\"'\"''" % u)
342 self.assertRaises(TypeError, shlex.quote, 42)
343 self.assertRaises(TypeError, shlex.quote, b"abc")
344
345 def testJoin(self):
346 for split_command, command in [

Callers

nothing calls this directly

Calls 3

quoteMethod · 0.80
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected