python-aiohttp/invalid-escapes-in-tests.patch
Matej Cepl 7ed81b114e - Upgrade to 3.4.4:
- Multiple small bugfixes
- Remove remove-failing-tests-due-to-pytest-timeout-issues.patch
- Add invalid-escapes-in-tests.patch to fix invalid escapes in
  non-raw regexp strings.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-aiohttp?expand=0&rev=26
2018-10-06 09:20:40 +00:00

99 lines
4.3 KiB
Diff

--- a/tests/test_http_parser.py
+++ b/tests/test_http_parser.py
@@ -369,7 +369,7 @@ def test_max_header_field_size(parser, s
name = b't' * size
text = (b'GET /test HTTP/1.1\r\n' + name + b':data\r\n\r\n')
- match = ("400, message='Got more than 8190 bytes \({}\) when reading"
+ match = (r"400, message='Got more than 8190 bytes \({}\) when reading"
.format(size))
with pytest.raises(http_exceptions.LineTooLong, match=match):
parser.feed_data(text)
@@ -399,7 +399,7 @@ def test_max_header_value_size(parser, s
text = (b'GET /test HTTP/1.1\r\n'
b'data:' + name + b'\r\n\r\n')
- match = ("400, message='Got more than 8190 bytes \({}\) when reading"
+ match = (r"400, message='Got more than 8190 bytes \({}\) when reading"
.format(size))
with pytest.raises(http_exceptions.LineTooLong, match=match):
parser.feed_data(text)
@@ -430,7 +430,7 @@ def test_max_header_value_size_continuat
text = (b'GET /test HTTP/1.1\r\n'
b'data: test\r\n ' + name + b'\r\n\r\n')
- match = ("400, message='Got more than 8190 bytes \({}\) when reading"
+ match = (r"400, message='Got more than 8190 bytes \({}\) when reading"
.format(size))
with pytest.raises(http_exceptions.LineTooLong, match=match):
parser.feed_data(text)
@@ -551,7 +551,7 @@ def test_http_request_parser_bad_version
@pytest.mark.parametrize('size', [40965, 8191])
def test_http_request_max_status_line(parser, size):
path = b't' * (size - 5)
- match = ("400, message='Got more than 8190 bytes \({}\) when reading"
+ match = (r"400, message='Got more than 8190 bytes \({}\) when reading"
.format(size))
with pytest.raises(http_exceptions.LineTooLong, match=match):
parser.feed_data(
@@ -595,7 +595,7 @@ def test_http_response_parser_utf8(respo
@pytest.mark.parametrize('size', [40962, 8191])
def test_http_response_parser_bad_status_line_too_long(response, size):
reason = b't' * (size - 2)
- match = ("400, message='Got more than 8190 bytes \({}\) when reading"
+ match = (r"400, message='Got more than 8190 bytes \({}\) when reading"
.format(size))
with pytest.raises(http_exceptions.LineTooLong, match=match):
response.feed_data(
--- a/tests/test_streams.py
+++ b/tests/test_streams.py
@@ -721,7 +721,7 @@ class TestStreamReader:
async def test___repr__waiter(self, loop):
stream = self._make_one()
stream._waiter = loop.create_future()
- assert re.search("<StreamReader w=<Future pending[\S ]*>>",
+ assert re.search(r"<StreamReader w=<Future pending[\S ]*>>",
repr(stream))
stream._waiter.set_result(None)
await stream._waiter
--- a/tests/test_urldispatch.py
+++ b/tests/test_urldispatch.py
@@ -586,7 +586,7 @@ def test_add_route_with_invalid_re(route
def test_route_dynamic_with_regex_spec(router):
handler = make_handler()
- route = router.add_route('GET', '/get/{num:^\d+}', handler,
+ route = router.add_route('GET', r'/get/{num:^\d+}', handler,
name='name')
url = route.url_for(num='123')
@@ -595,7 +595,7 @@ def test_route_dynamic_with_regex_spec(r
def test_route_dynamic_with_regex_spec_and_trailing_slash(router):
handler = make_handler()
- route = router.add_route('GET', '/get/{num:^\d+}/', handler,
+ route = router.add_route('GET', r'/get/{num:^\d+}/', handler,
name='name')
url = route.url_for(num='123')
@@ -1125,7 +1125,7 @@ def test_plain_resource_canonical():
def test_dynamic_resource_canonical():
canonicals = {
'/get/{name}': '/get/{name}',
- '/get/{num:^\d+}': '/get/{num}',
+ r'/get/{num:^\d+}': '/get/{num}',
r'/handler/{to:\d+}': r'/handler/{to}',
r'/{one}/{two:.+}': r'/{one}/{two}',
}
--- a/tests/test_web_request.py
+++ b/tests/test_web_request.py
@@ -340,7 +340,7 @@ def test_single_forwarded_header_multipl
def test_single_forwarded_header_quoted_escaped():
- header = 'BY=identifier;pROTO="\lala lan\d\~ 123\!&"'
+ header = r'BY=identifier;pROTO="\lala lan\d\~ 123\!&"'
req = make_mocked_request('GET', '/',
headers=CIMultiDict({'Forwarded': header}))
assert req.forwarded[0]['by'] == 'identifier'