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

Method test_unquoting

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

Source from the content-addressed store, hash-verified

996 """
997
998 def test_unquoting(self):
999 # Make sure unquoting of all ASCII values works
1000 escape_list = []
1001 for num in range(128):
1002 given = hexescape(chr(num))
1003 expect = chr(num)
1004 result = urllib.parse.unquote(given)
1005 self.assertEqual(expect, result,
1006 "using unquote(): %r != %r" % (expect, result))
1007 result = urllib.parse.unquote_plus(given)
1008 self.assertEqual(expect, result,
1009 "using unquote_plus(): %r != %r" %
1010 (expect, result))
1011 escape_list.append(given)
1012 escape_string = ''.join(escape_list)
1013 del escape_list
1014 result = urllib.parse.unquote(escape_string)
1015 self.assertEqual(result.count('%'), 1,
1016 "using unquote(): not all characters escaped: "
1017 "%s" % result)
1018
1019 def test_unquote_rejects_none_and_tuple(self):
1020 self.assertRaises((TypeError, AttributeError), urllib.parse.unquote, None)

Callers

nothing calls this directly

Calls 5

hexescapeFunction · 0.85
assertEqualMethod · 0.45
appendMethod · 0.45
joinMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected