(self)
| 827 | self.assertEqual(urllib.parse.quote.__defaults__[0], '/') |
| 828 | |
| 829 | def test_safe(self): |
| 830 | # Test setting 'safe' parameter does what it should do |
| 831 | quote_by_default = "<>" |
| 832 | result = urllib.parse.quote(quote_by_default, safe=quote_by_default) |
| 833 | self.assertEqual(quote_by_default, result, |
| 834 | "using quote(): %r != %r" % (quote_by_default, result)) |
| 835 | result = urllib.parse.quote_plus(quote_by_default, |
| 836 | safe=quote_by_default) |
| 837 | self.assertEqual(quote_by_default, result, |
| 838 | "using quote_plus(): %r != %r" % |
| 839 | (quote_by_default, result)) |
| 840 | # Safe expressed as bytes rather than str |
| 841 | result = urllib.parse.quote(quote_by_default, safe=b"<>") |
| 842 | self.assertEqual(quote_by_default, result, |
| 843 | "using quote(): %r != %r" % (quote_by_default, result)) |
| 844 | # "Safe" non-ASCII characters should have no effect |
| 845 | # (Since URIs are not allowed to have non-ASCII characters) |
| 846 | result = urllib.parse.quote("a\xfcb", encoding="latin-1", safe="\xfc") |
| 847 | expect = urllib.parse.quote("a\xfcb", encoding="latin-1", safe="") |
| 848 | self.assertEqual(expect, result, |
| 849 | "using quote(): %r != %r" % |
| 850 | (expect, result)) |
| 851 | # Same as above, but using a bytes rather than str |
| 852 | result = urllib.parse.quote("a\xfcb", encoding="latin-1", safe=b"\xfc") |
| 853 | expect = urllib.parse.quote("a\xfcb", encoding="latin-1", safe="") |
| 854 | self.assertEqual(expect, result, |
| 855 | "using quote(): %r != %r" % |
| 856 | (expect, result)) |
| 857 | |
| 858 | def test_default_quoting(self): |
| 859 | # Make sure all characters that should be quoted are by default sans |
nothing calls this directly
no test coverage detected