MCPcopy Index your code
hub / github.com/RustPython/RustPython / testQuote

Method testQuote

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

Source from the content-addressed store, hash-verified

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