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

Method test_quoting_space

Lib/test/test_urllib.py:886–903  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

884 "using quote_plus(): %r != %r" % (expected, result))
885
886 def test_quoting_space(self):
887 # Make sure quote() and quote_plus() handle spaces as specified in
888 # their unique way
889 result = urllib.parse.quote(' ')
890 self.assertEqual(result, hexescape(' '),
891 "using quote(): %r != %r" % (result, hexescape(' ')))
892 result = urllib.parse.quote_plus(' ')
893 self.assertEqual(result, '+',
894 "using quote_plus(): %r != +" % result)
895 given = "a b cd e f"
896 expect = given.replace(' ', hexescape(' '))
897 result = urllib.parse.quote(given)
898 self.assertEqual(expect, result,
899 "using quote(): %r != %r" % (expect, result))
900 expect = given.replace(' ', '+')
901 result = urllib.parse.quote_plus(given)
902 self.assertEqual(expect, result,
903 "using quote_plus(): %r != %r" % (expect, result))
904
905 def test_quoting_plus(self):
906 self.assertEqual(urllib.parse.quote_plus('alpha+beta gamma'),

Callers

nothing calls this directly

Calls 4

hexescapeFunction · 0.85
quoteMethod · 0.80
assertEqualMethod · 0.45
replaceMethod · 0.45

Tested by

no test coverage detected