python-aiohttp/remove-re-assert.patch

196 lines
6.0 KiB
Diff

diff -Nru aiohttp-3.9.3.orig/tests/test_client_session.py aiohttp-3.9.3/tests/test_client_session.py
--- aiohttp-3.9.3.orig/tests/test_client_session.py 2024-01-29 20:32:25.000000000 +0100
+++ aiohttp-3.9.3/tests/test_client_session.py 2024-01-30 11:20:09.652810999 +0100
@@ -2,6 +2,7 @@
import contextlib
import gc
import io
+import re
import json
from http.cookies import SimpleCookie
from typing import Any, List
@@ -9,7 +10,6 @@
import pytest
from multidict import CIMultiDict, MultiDict
-from re_assert import Matches
from yarl import URL
import aiohttp
@@ -320,8 +320,8 @@
loop.run_until_complete(make_sess())
assert (
- Matches("Session and connector has to use same event loop")
- == str(ctx.value).strip()
+ re.match("Session and connector has to use same event loop",
+ str(ctx.value).strip())
)
another_loop.run_until_complete(connector.close())
diff -Nru aiohttp-3.9.3.orig/tests/test_streams.py aiohttp-3.9.3/tests/test_streams.py
--- aiohttp-3.9.3.orig/tests/test_streams.py 2024-01-29 20:32:25.000000000 +0100
+++ aiohttp-3.9.3/tests/test_streams.py 2024-01-30 11:20:09.652810999 +0100
@@ -3,13 +3,13 @@
import abc
import asyncio
import gc
+import re
import types
from collections import defaultdict
from itertools import groupby
from unittest import mock
import pytest
-from re_assert import Matches
from aiohttp import streams
@@ -1102,7 +1102,7 @@
loop = asyncio.get_event_loop()
stream = self._make_one()
stream._waiter = loop.create_future()
- assert Matches(r"<StreamReader w=<Future pending[\S ]*>>") == repr(stream)
+ assert re.match(r"<StreamReader w=<Future pending[\S ]*>>", repr(stream))
stream._waiter.set_result(None)
await stream._waiter
stream._waiter = None
diff -Nru aiohttp-3.9.3.orig/tests/test_urldispatch.py aiohttp-3.9.3/tests/test_urldispatch.py
--- aiohttp-3.9.3.orig/tests/test_urldispatch.py 2024-01-29 20:32:25.000000000 +0100
+++ aiohttp-3.9.3/tests/test_urldispatch.py 2024-01-30 11:21:46.656743543 +0100
@@ -4,7 +4,6 @@
from urllib.parse import unquote
import pytest
-from re_assert import Matches
from yarl import URL
import aiohttp
@@ -312,7 +311,7 @@
regexp = "Duplicate 'name', already handled by"
with pytest.raises(ValueError) as ctx:
router.add_route("GET", "/get_other", handler2, name="name")
- assert Matches(regexp) == str(ctx.value)
+ assert re.match(regexp, str(ctx.value))
def test_route_plain(router) -> None:
@@ -502,7 +501,7 @@
def test_static_repr(router) -> None:
router.add_static("/get", pathlib.Path(aiohttp.__file__).parent, name="name")
- assert Matches(r"<StaticResource 'name' /get") == repr(router["name"])
+ assert re.match(r"<StaticResource 'name' /get", repr(router["name"]))
def test_static_adds_slash(router) -> None:
@@ -624,7 +623,7 @@
req = make_mocked_request("GET", "/get/john")
match_info = await router.resolve(req)
assert {"name": "john"} == match_info
- assert Matches("<MatchInfo {'name': 'john'}: .+<Dynamic.+>>") == repr(match_info)
+ assert re.match("<MatchInfo {'name': 'john'}: .+<Dynamic.+>>", repr(match_info))
async def test_match_info_with_plus(router) -> None:
diff -Nru aiohttp-3.9.3.orig/tests/test_web_response.py aiohttp-3.9.3/tests/test_web_response.py
--- aiohttp-3.9.3.orig/tests/test_web_response.py 2024-01-29 20:32:25.000000000 +0100
+++ aiohttp-3.9.3/tests/test_web_response.py 2024-01-30 11:20:09.656144352 +0100
@@ -2,13 +2,13 @@
import datetime
import gzip
import json
+import re
from concurrent.futures import ThreadPoolExecutor
from unittest import mock
import aiosignal
import pytest
from multidict import CIMultiDict, CIMultiDictProxy
-from re_assert import Matches
from aiohttp import HttpVersion, HttpVersion10, HttpVersion11, hdrs
from aiohttp.helpers import ETag
@@ -401,7 +401,9 @@
with pytest.raises(RuntimeError) as ctx:
await resp.prepare(req)
- assert Matches("Using chunked encoding is forbidden for HTTP/1.0") == str(ctx.value)
+ assert re.match(
+ "Using chunked encoding is forbidden for HTTP/1.0", str(ctx.value)
+ )
async def test_compression_no_accept() -> None:
@@ -843,7 +845,7 @@
'Set-Cookie: name=("")?; '
"expires=Thu, 01 Jan 1970 00:00:00 GMT; Max-Age=0; Path=/"
)
- assert Matches(expected) == str(resp.cookies)
+ assert re.match(expected, str(resp.cookies))
resp.set_cookie("name", "value", domain="local.host")
expected = "Set-Cookie: name=value; Domain=local.host; Path=/"
@@ -895,7 +897,7 @@
'Set-Cookie: name=("")?; '
"expires=Thu, 01 Jan 1970 00:00:00 GMT; Max-Age=0; Path=/"
)
- assert Matches(expected) == str(resp.cookies)
+ assert re.match(expected, str(resp.cookies))
def test_cookie_set_after_del() -> None:
@@ -1136,14 +1138,13 @@
await resp.write_eof()
txt = buf.decode("utf8")
assert (
- Matches(
+ re.match(
"HTTP/1.1 200 OK\r\n"
"Content-Length: 0\r\n"
"Content-Type: application/octet-stream\r\n"
"Date: .+\r\n"
"Server: .+\r\n\r\n"
- )
- == txt
+ , txt)
)
@@ -1156,15 +1157,13 @@
txt = buf.decode("utf8")
assert (
- Matches(
+ re.match(
"HTTP/1.1 200 OK\r\n"
"Content-Length: 4\r\n"
"Content-Type: application/octet-stream\r\n"
"Date: .+\r\n"
"Server: .+\r\n\r\n"
- "data"
- )
- == txt
+ "data", txt)
)
@@ -1178,15 +1177,13 @@
txt = buf.decode("utf8")
assert (
- Matches(
+ re.match(
"HTTP/1.1 200 OK\r\n"
"Content-Length: 0\r\n"
"Set-Cookie: name=value\r\n"
"Content-Type: application/octet-stream\r\n"
"Date: .+\r\n"
- "Server: .+\r\n\r\n"
- )
- == txt
+ "Server: .+\r\n\r\n", txt)
)