A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/python/cpython/commit/c9f07813ab8e664d8c34413c4fc2d4f86c061a92 below:

only use '&' as a query string separator (GH-24297) … · python/cpython@c9f0781 · GitHub

32 32

(b"&a=b", [(b'a', b'b')]),

33 33

(b"a=a+b&b=b+c", [(b'a', b'a b'), (b'b', b'b c')]),

34 34

(b"a=1&a=2", [(b'a', b'1'), (b'a', b'2')]),

35 -

(";", []),

36 -

(";;", []),

37 -

(";a=b", [('a', 'b')]),

38 -

("a=a+b;b=b+c", [('a', 'a b'), ('b', 'b c')]),

39 -

("a=1;a=2", [('a', '1'), ('a', '2')]),

40 -

(b";", []),

41 -

(b";;", []),

42 -

(b";a=b", [(b'a', b'b')]),

43 -

(b"a=a+b;b=b+c", [(b'a', b'a b'), (b'b', b'b c')]),

44 -

(b"a=1;a=2", [(b'a', b'1'), (b'a', b'2')]),

35 +

(";a=b", [(';a', 'b')]),

36 +

("a=a+b;b=b+c", [('a', 'a b;b=b c')]),

37 +

(b";a=b", [(b';a', b'b')]),

38 +

(b"a=a+b;b=b+c", [(b'a', b'a b;b=b c')]),

45 39

]

46 40 47 41

# Each parse_qs testcase is a two-tuple that contains

68 62

(b"&a=b", {b'a': [b'b']}),

69 63

(b"a=a+b&b=b+c", {b'a': [b'a b'], b'b': [b'b c']}),

70 64

(b"a=1&a=2", {b'a': [b'1', b'2']}),

71 -

(";", {}),

72 -

(";;", {}),

73 -

(";a=b", {'a': ['b']}),

74 -

("a=a+b;b=b+c", {'a': ['a b'], 'b': ['b c']}),

75 -

("a=1;a=2", {'a': ['1', '2']}),

76 -

(b";", {}),

77 -

(b";;", {}),

78 -

(b";a=b", {b'a': [b'b']}),

79 -

(b"a=a+b;b=b+c", {b'a': [b'a b'], b'b': [b'b c']}),

80 -

(b"a=1;a=2", {b'a': [b'1', b'2']}),

65 +

(";a=b", {';a': ['b']}),

66 +

("a=a+b;b=b+c", {'a': ['a b;b=b c']}),

67 +

(b";a=b", {b';a': [b'b']}),

68 +

(b"a=a+b;b=b+c", {b'a':[ b'a b;b=b c']}),

81 69

]

82 70 83 71

class UrlParseTestCase(unittest.TestCase):

@@ -886,10 +874,46 @@ def test_parse_qsl_encoding(self):

886 874

def test_parse_qsl_max_num_fields(self):

887 875

with self.assertRaises(ValueError):

888 876

urllib.parse.parse_qs('&'.join(['a=a']*11), max_num_fields=10)

889 -

with self.assertRaises(ValueError):

890 -

urllib.parse.parse_qs(';'.join(['a=a']*11), max_num_fields=10)

891 877

urllib.parse.parse_qs('&'.join(['a=a']*10), max_num_fields=10)

892 878 879 +

def test_parse_qs_separator(self):

880 +

parse_qs_semicolon_cases = [

881 +

(";", {}),

882 +

(";;", {}),

883 +

(";a=b", {'a': ['b']}),

884 +

("a=a+b;b=b+c", {'a': ['a b'], 'b': ['b c']}),

885 +

("a=1;a=2", {'a': ['1', '2']}),

886 +

(b";", {}),

887 +

(b";;", {}),

888 +

(b";a=b", {b'a': [b'b']}),

889 +

(b"a=a+b;b=b+c", {b'a': [b'a b'], b'b': [b'b c']}),

890 +

(b"a=1;a=2", {b'a': [b'1', b'2']}),

891 +

]

892 +

for orig, expect in parse_qs_semicolon_cases:

893 +

with self.subTest(f"Original: {orig!r}, Expected: {expect!r}"):

894 +

result = urllib.parse.parse_qs(orig, separator=';')

895 +

self.assertEqual(result, expect, "Error parsing %r" % orig)

896 + 897 + 898 +

def test_parse_qsl_separator(self):

899 +

parse_qsl_semicolon_cases = [

900 +

(";", []),

901 +

(";;", []),

902 +

(";a=b", [('a', 'b')]),

903 +

("a=a+b;b=b+c", [('a', 'a b'), ('b', 'b c')]),

904 +

("a=1;a=2", [('a', '1'), ('a', '2')]),

905 +

(b";", []),

906 +

(b";;", []),

907 +

(b";a=b", [(b'a', b'b')]),

908 +

(b"a=a+b;b=b+c", [(b'a', b'a b'), (b'b', b'b c')]),

909 +

(b"a=1;a=2", [(b'a', b'1'), (b'a', b'2')]),

910 +

]

911 +

for orig, expect in parse_qsl_semicolon_cases:

912 +

with self.subTest(f"Original: {orig!r}, Expected: {expect!r}"):

913 +

result = urllib.parse.parse_qsl(orig, separator=';')

914 +

self.assertEqual(result, expect, "Error parsing %r" % orig)

915 + 916 + 893 917

def test_urlencode_sequences(self):

894 918

# Other tests incidentally urlencode things; test non-covered cases:

895 919

# Sequence and object values.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4