Compare commits

...

2 Commits

Author SHA1 Message Date
dirkf
bbd3e7e999 [utils] Properly handle list values in update_url()
An actual list value in a query update could have been treated
as a list of values because of the key:list parse_qs format.
2023-09-03 01:18:22 +01:00
dirkf
21caaf2380 [test] Remove redundancy from lambda expected value regex 2023-09-03 01:13:40 +01:00
2 changed files with 2 additions and 2 deletions

View File

@ -142,7 +142,7 @@ def expect_value(self, got, expected, field):
self.assertTrue( self.assertTrue(
contains_str in got, contains_str in got,
'field %s (value: %r) should contain %r' % (field, got, contains_str)) 'field %s (value: %r) should contain %r' % (field, got, contains_str))
elif isinstance(expected, compat_str) and re.match(r'^lambda \w+:', expected): elif isinstance(expected, compat_str) and re.match(r'lambda \w+:', expected):
fn = eval(expected) fn = eval(expected)
suite = expected.split(':', 1)[1].strip() suite = expected.split(':', 1)[1].strip()
self.assertTrue( self.assertTrue(

View File

@ -4257,7 +4257,7 @@ def update_url(url, **kwargs):
query = kwargs.pop('query_update', None) query = kwargs.pop('query_update', None)
if query: if query:
qs = compat_parse_qs(url.query) qs = compat_parse_qs(url.query)
qs.update(query) qs.update((k, [v]) for k, v in query.items())
kwargs['query'] = compat_urllib_parse_urlencode(qs, True) kwargs['query'] = compat_urllib_parse_urlencode(qs, True)
kwargs = compat_kwargs(kwargs) kwargs = compat_kwargs(kwargs)
return compat_urllib_parse.urlunparse(url._replace(**kwargs)) return compat_urllib_parse.urlunparse(url._replace(**kwargs))