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

Method test_quote_bytes

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

Source from the content-addressed store, hash-verified

915 'alpha+beta+gamma')
916
917 def test_quote_bytes(self):
918 # Bytes should quote directly to percent-encoded values
919 given = b"\xa2\xd8ab\xff"
920 expect = "%A2%D8ab%FF"
921 result = urllib.parse.quote(given)
922 self.assertEqual(expect, result,
923 "using quote(): %r != %r" % (expect, result))
924 # Encoding argument should raise type error on bytes input
925 self.assertRaises(TypeError, urllib.parse.quote, given,
926 encoding="latin-1")
927 # quote_from_bytes should work the same
928 result = urllib.parse.quote_from_bytes(given)
929 self.assertEqual(expect, result,
930 "using quote_from_bytes(): %r != %r"
931 % (expect, result))
932
933 def test_quote_with_unicode(self):
934 # Characters in Latin-1 range, encoded by default in UTF-8

Callers

nothing calls this directly

Calls 3

quoteMethod · 0.80
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected