instance_id stringclasses 28
values | test_id stringlengths 30 622 | affected bool 2
classes | text stringlengths 301 41.6M | license stringclasses 5
values |
|---|---|---|---|---|
wtforms__wtforms-614 | tests/test_i18n.py::TestI18N::test_python2_wrap | false | def test_python2_wrap(self):
translator = Python2_Translator()
translations = self._test_converter(translator)
assert translations is not translator
# --- trace ---
# === tests/test_i18n.py::TestI18N.test_python2_wrap (line 50) ===
def test_python2_wrap(self):
# ENTER: self=Test... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_i18n.py::TestI18N::test_python3_nowrap | false | def test_python3_nowrap(self):
translator = Lower_Translator()
translations = self._test_converter(translator)
assert translations is translator
# --- trace ---
# === tests/test_i18n.py::TestI18N.test_python3_nowrap (line 55) ===
def test_python3_nowrap(self):
# ENTER: self=Test... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_i18n.py::TestI18N::test_us_translation | false | def test_us_translation(self):
translations = get_translations(["en_US"])
assert translations.gettext("Invalid Mac address.") == "Invalid MAC address."
# --- trace ---
# === tests/test_i18n.py::TestI18N.test_us_translation (line 39) ===
def test_us_translation(self):
# ENTER: self=TestI... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_i18n.py::TestTranslations::test_gettext | false | def test_gettext(self):
x = "foo"
assert self.F().a.gettext(x) is x
# --- trace ---
# === tests/test_i18n.py::TestTranslations.test_gettext (line 153) ===
def test_gettext(self):
# ENTER: self=TestTranslations({})
x = "foo" # x='foo'
assert self.F().a.gettext(x) is x
#... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_i18n.py::TestTranslations::test_ngettext | false | def test_ngettext(self):
def getit(n):
return self.F().a.ngettext("antelope", "antelopes", n)
assert getit(0) == "antelopes"
assert getit(1) == "antelope"
assert getit(2) == "antelopes"
# --- trace ---
# === tests/test_i18n.py::TestTranslations.test_ngettext (line 157) ... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_i18n.py::TestTranslations::test_validator_translation | false | def test_validator_translation(self):
form = self.F2(a="hellobye")
assert not form.validate()
assert form.a.errors[0] == "field cannot be longer than 5 characters."
form = self.F(a="hellobye")
assert not form.validate()
assert form.a.errors[0] == "Field cannot be long... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_locale_babel.py::TestLocaleDecimal::test_formatting | false | def test_formatting(self):
val = Decimal("123456.789")
neg = Decimal("-5.2")
self._format_test("1,23,456.789", val)
self._format_test("-12,52,378.2", "-1252378.2")
self._format_test("123,456.789", val, ["en_US"])
self._format_test("-5.2", neg, ["en_US"])
self.... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_locale_babel.py::TestLocaleDecimal::test_parsing | false | def test_parsing(self):
expected = Decimal("123456.789")
self._parse_test("1,23,456.789", expected)
self._parse_test("1,23,456.789", expected, ["en_US"])
self._parse_test("1.23.456,789", expected, ["de_DE"])
self._parse_test("1’23’456.789", expected, ["de_CH"])
self.... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_locale_babel.py::TestLocaleDecimal::test_typeerror | false | def test_typeerror(self):
def build(**kw):
form = self.F()
DecimalField(
use_locale=True,
name="a",
_form=form,
_translations=form.meta.get_translations(form),
**kw
)
with pytest.rais... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_webob.py::test_automatic_wrapping | false | def test_automatic_wrapping(filled_mdict):
def _check(formdata):
assert isinstance(formdata, WebobInputWrapper)
form = BaseForm({"a": SneakyField(_check)})
form.process(filled_mdict)
# --- trace ---
# === tests/test_webob.py::test_automatic_wrapping (line 70) ===
def test_automatic_wrapping(filled... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_webob.py::test_empty | false | def test_empty(empty_mdict):
formdata = WebobInputWrapper(empty_mdict)
assert not formdata
assert len(formdata) == 0
assert list(formdata) == []
assert formdata.getlist("fake") == []
# --- trace ---
# === tests/test_webob.py::test_empty (line 78) ===
def test_empty(empty_mdict):
# ENTER: empty_... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_webob.py::test_filled | false | def test_filled(filled_mdict):
formdata = WebobInputWrapper(filled_mdict)
assert formdata
assert len(formdata) == 3
assert list(formdata) == ["a", "b", "a"]
assert "b" in formdata
assert "fake" not in formdata
assert formdata.getlist("a") == ["Apple", "Cherry"]
assert formdata.getlist("b... | BSD-3-Clause |
aio-libs__aiohttp-9047 | tests/test_connector.py::TestDNSCacheTable::test_always_expire | true | def test_always_expire(self, monkeypatch: pytest.MonkeyPatch) -> None:
dns_cache_table = _DNSCacheTable(ttl=0)
monkeypatch.setattr("aiohttp.connector.monotonic", lambda: 1)
dns_cache_table.add("localhost", ["127.0.0.1"])
monkeypatch.setattr("aiohttp.connector.monotonic", lambda: 1.00... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::TestDNSCacheTable::test_clear | true | def test_clear(self, dns_cache_table) -> None:
dns_cache_table.add("localhost", ["127.0.0.1"])
dns_cache_table.clear()
with pytest.raises(KeyError):
dns_cache_table.next_addrs("localhost")
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES/9032.bugfix.rst b/CHANGES... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::TestDNSCacheTable::test_expired_ttl | true | def test_expired_ttl(self, monkeypatch: pytest.MonkeyPatch) -> None:
dns_cache_table = _DNSCacheTable(ttl=1)
monkeypatch.setattr("aiohttp.connector.monotonic", lambda: 1)
dns_cache_table.add("localhost", ["127.0.0.1"])
monkeypatch.setattr("aiohttp.connector.monotonic", lambda: 2)
... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::TestDNSCacheTable::test_never_expire | true | def test_never_expire(self, monkeypatch: pytest.MonkeyPatch) -> None:
dns_cache_table = _DNSCacheTable(ttl=None)
monkeypatch.setattr("aiohttp.connector.monotonic", lambda: 1)
dns_cache_table.add("localhost", ["127.0.0.1"])
monkeypatch.setattr("aiohttp.connector.monotonic", lambda: 10... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::TestDNSCacheTable::test_next_addrs | true | def test_next_addrs(self, dns_cache_table) -> None:
dns_cache_table.add("foo", ["127.0.0.1", "127.0.0.2", "127.0.0.3"])
# Each calls to next_addrs return the hosts using
# a round robin strategy.
addrs = dns_cache_table.next_addrs("foo")
assert addrs == ["127.0.0.1", "127.0.... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::TestDNSCacheTable::test_next_addrs_basic | true | def test_next_addrs_basic(self, dns_cache_table) -> None:
dns_cache_table.add("localhost", ["127.0.0.1"])
dns_cache_table.add("foo", ["127.0.0.2"])
addrs = dns_cache_table.next_addrs("localhost")
assert addrs == ["127.0.0.1"]
addrs = dns_cache_table.next_addrs("foo")
... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::TestDNSCacheTable::test_next_addrs_single | true | def test_next_addrs_single(self, dns_cache_table) -> None:
dns_cache_table.add("foo", ["127.0.0.1"])
addrs = dns_cache_table.next_addrs("foo")
assert addrs == ["127.0.0.1"]
addrs = dns_cache_table.next_addrs("foo")
assert addrs == ["127.0.0.1"]
# --- pre-patch trace ---
... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::TestDNSCacheTable::test_not_expired_ttl | true | def test_not_expired_ttl(self) -> None:
dns_cache_table = _DNSCacheTable(ttl=0.1)
dns_cache_table.add("localhost", ["127.0.0.1"])
assert not dns_cache_table.expired("localhost")
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES/9032.bugfix.rst b/CHANGES/9032.bugfix.rst
new fi... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::TestDNSCacheTable::test_not_expired_ttl_None | true | def test_not_expired_ttl_None(self, dns_cache_table) -> None:
dns_cache_table.add("localhost", ["127.0.0.1"])
assert not dns_cache_table.expired("localhost")
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES/9032.bugfix.rst b/CHANGES/9032.bugfix.rst
new file mode 100644
index 0000000... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::TestDNSCacheTable::test_remove | true | def test_remove(self, dns_cache_table) -> None:
dns_cache_table.add("localhost", ["127.0.0.1"])
dns_cache_table.remove("localhost")
with pytest.raises(KeyError):
dns_cache_table.next_addrs("localhost")
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES/9032.bugfix.... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test___get_ssl_context1 | true | async def test___get_ssl_context1() -> None:
conn = aiohttp.TCPConnector()
req = mock.Mock()
req.is_ssl.return_value = False
assert conn._get_ssl_context(req) is None
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES/9032.bugfix.rst b/CHANGES/9032.bugfix.rst
new file mode 100644
index 00... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test___get_ssl_context2[pyloop] | true | async def test___get_ssl_context2(loop) -> None:
ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
conn = aiohttp.TCPConnector(loop=loop)
req = mock.Mock()
req.is_ssl.return_value = True
req.ssl = ctx
assert conn._get_ssl_context(req) is ctx
# --- pre-patch trace ---
# --- patch ---
diff --git a/... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test___get_ssl_context3[pyloop] | true | async def test___get_ssl_context3(loop) -> None:
ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
conn = aiohttp.TCPConnector(loop=loop, ssl=ctx)
req = mock.Mock()
req.is_ssl.return_value = True
req.ssl = True
assert conn._get_ssl_context(req) is ctx
# --- pre-patch trace ---
# --- patch ---
dif... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test___get_ssl_context4[pyloop] | true | async def test___get_ssl_context4(loop) -> None:
ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
conn = aiohttp.TCPConnector(loop=loop, ssl=ctx)
req = mock.Mock()
req.is_ssl.return_value = True
req.ssl = False
assert conn._get_ssl_context(req) is _SSL_CONTEXT_UNVERIFIED
# --- pre-patch trace ---
... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test___get_ssl_context5[pyloop] | true | async def test___get_ssl_context5(loop) -> None:
ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
conn = aiohttp.TCPConnector(loop=loop, ssl=ctx)
req = mock.Mock()
req.is_ssl.return_value = True
req.ssl = aiohttp.Fingerprint(hashlib.sha256(b"1").digest())
assert conn._get_ssl_context(req) is _SSL_C... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test___get_ssl_context6 | true | async def test___get_ssl_context6() -> None:
conn = aiohttp.TCPConnector()
req = mock.Mock()
req.is_ssl.return_value = True
req.ssl = True
assert conn._get_ssl_context(req) is _SSL_CONTEXT_VERIFIED
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES/9032.bugfix.rst b/CHANGES/9032.bugfi... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test__drop_acquire_per_host1[pyloop] | true | async def test__drop_acquire_per_host1(loop) -> None:
conn = aiohttp.BaseConnector(loop=loop)
conn._drop_acquired_per_host(123, 456)
assert len(conn._acquired_per_host) == 0
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES/9032.bugfix.rst b/CHANGES/9032.bugfix.rst
new file mode 100644
index... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test__drop_acquire_per_host2[pyloop] | true | async def test__drop_acquire_per_host2(loop) -> None:
conn = aiohttp.BaseConnector(loop=loop)
conn._acquired_per_host[123].add(456)
conn._drop_acquired_per_host(123, 456)
assert len(conn._acquired_per_host) == 0
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES/9032.bugfix.rst b/CHANGES/... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test__drop_acquire_per_host3[pyloop] | true | async def test__drop_acquire_per_host3(loop) -> None:
conn = aiohttp.BaseConnector(loop=loop)
conn._acquired_per_host[123].add(456)
conn._acquired_per_host[123].add(789)
conn._drop_acquired_per_host(123, 456)
assert len(conn._acquired_per_host) == 1
assert conn._acquired_per_host[123] == {789}
... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_async_context_manager[pyloop] | true | async def test_async_context_manager(loop) -> None:
conn = aiohttp.BaseConnector(loop=loop)
async with conn as c:
assert conn is c
assert conn.closed
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES/9032.bugfix.rst b/CHANGES/9032.bugfix.rst
new file mode 100644
index 000000000..8c... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_base_connector_allows_high_level_protocols[pyloop] | true | async def test_base_connector_allows_high_level_protocols(
loop: asyncio.AbstractEventLoop,
) -> None:
conn = aiohttp.BaseConnector()
assert conn.allowed_protocol_schema_set == {
"",
"http",
"https",
"ws",
"wss",
}
# --- pre-patch trace ---
# --- patch ---
diff... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_cancelled_waiter[pyloop] | true | async def test_cancelled_waiter(loop) -> None:
conn = aiohttp.BaseConnector(limit=1, loop=loop)
req = mock.Mock()
req.connection_key = "key"
proto = mock.Mock()
async def create_connection(req, traces=None):
await asyncio.sleep(1)
return proto
conn._create_connection = create_c... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_cleanup | true | async def test_cleanup(key) -> None:
testset = {
key: [(mock.Mock(), 10), (mock.Mock(), 300)],
}
testset[key][0][0].is_connected.return_value = True
testset[key][1][0].is_connected.return_value = False
loop = mock.Mock()
loop.time.return_value = 300
conn = aiohttp.BaseConnector(loop... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_cleanup2 | true | async def test_cleanup2() -> None:
testset = {1: [(mock.Mock(), 300)]}
testset[1][0][0].is_connected.return_value = True
loop = mock.Mock()
loop.time.return_value = 300
conn = aiohttp.BaseConnector(loop=loop, keepalive_timeout=10)
conn._conns = testset
conn._cleanup()
assert conn._conn... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_cleanup3 | true | async def test_cleanup3(key) -> None:
testset = {key: [(mock.Mock(), 290.1), (mock.Mock(), 305.1)]}
testset[key][0][0].is_connected.return_value = True
loop = mock.Mock()
loop.time.return_value = 308.5
conn = aiohttp.BaseConnector(loop=loop, keepalive_timeout=10)
conn._conns = testset
con... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_cleanup_close_ssl_transport | true | async def test_cleanup_close_ssl_transport(ssl_key) -> None:
proto = mock.Mock()
transport = proto.transport
testset = {ssl_key: [(proto, 10)]}
loop = mock.Mock()
loop.time.return_value = 300
conn = aiohttp.BaseConnector(loop=loop, enable_cleanup_closed=True)
conn._conns = testset
exist... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_cleanup_closed[pyloop] | true | async def test_cleanup_closed(loop, mocker) -> None:
if not hasattr(loop, "__dict__"):
pytest.skip("can not override loop attributes")
mocker.spy(loop, "call_at")
conn = aiohttp.BaseConnector(loop=loop, enable_cleanup_closed=True)
tr = mock.Mock()
conn._cleanup_closed_handle = cleanup_clos... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_cleanup_closed_disabled[pyloop] | true | async def test_cleanup_closed_disabled(loop, mocker) -> None:
conn = aiohttp.BaseConnector(loop=loop, enable_cleanup_closed=False)
tr = mock.Mock()
conn._cleanup_closed_transports = [tr]
conn._cleanup_closed()
assert tr.abort.called
assert not conn._cleanup_closed_transports
# --- pre-patch tr... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_close[pyloop] | true | async def test_close(loop) -> None:
proto = mock.Mock()
conn = aiohttp.BaseConnector(loop=loop)
assert not conn.closed
conn._conns[("host", 8080, False)] = [(proto, object())]
await conn.close()
assert not conn._conns
assert proto.close.called
assert conn.closed
# --- pre-patch trace ... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_close_abort_closed_transports[pyloop] | true | async def test_close_abort_closed_transports(loop: asyncio.AbstractEventLoop) -> None:
tr = mock.Mock()
conn = aiohttp.BaseConnector(loop=loop)
conn._cleanup_closed_transports.append(tr)
await conn.close()
assert not conn._cleanup_closed_transports
assert tr.abort.called
assert conn.closed... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_close_cancels_cleanup_closed_handle[pyloop] | true | async def test_close_cancels_cleanup_closed_handle(loop) -> None:
conn = aiohttp.BaseConnector(loop=loop, enable_cleanup_closed=True)
assert conn._cleanup_closed_handle is not None
await conn.close()
assert conn._cleanup_closed_handle is None
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHA... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_close_cancels_cleanup_handle[pyloop] | true | async def test_close_cancels_cleanup_handle(loop) -> None:
conn = aiohttp.BaseConnector(loop=loop)
conn._release(1, mock.Mock(should_close=False))
assert conn._cleanup_handle is not None
await conn.close()
assert conn._cleanup_handle is None
# --- pre-patch trace ---
# --- patch ---
diff --git a/... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_close_cancels_resolve_host[pyloop] | true | async def test_close_cancels_resolve_host(loop: asyncio.AbstractEventLoop) -> None:
cancelled = False
async def delay_resolve_host(*args: object) -> None:
"""Delay _resolve_host() task in order to test cancellation."""
nonlocal cancelled
try:
await asyncio.sleep(10)
... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_close_during_connect[pyloop] | true | async def test_close_during_connect(loop) -> None:
proto = mock.Mock()
proto.is_connected.return_value = True
fut = loop.create_future()
req = ClientRequest("GET", URL("http://host:80"), loop=loop)
conn = aiohttp.BaseConnector(loop=loop)
conn._create_connection = mock.Mock()
conn._create_c... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_close_twice[pyloop] | true | async def test_close_twice(loop) -> None:
proto = mock.Mock()
conn = aiohttp.BaseConnector(loop=loop)
conn._conns[1] = [(proto, object())]
await conn.close()
assert not conn._conns
assert proto.close.called
assert conn.closed
conn._conns = "Invalid" # fill with garbage
await conn... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_close_with_acquired_connection[pyloop] | true | async def test_close_with_acquired_connection(loop) -> None:
proto = mock.Mock()
proto.is_connected.return_value = True
req = ClientRequest("GET", URL("http://host:80"), loop=loop)
conn = aiohttp.BaseConnector(loop=loop, limit=1)
key = ("host", 80, False)
conn._conns[key] = [(proto, loop.time(... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_connect[pyloop] | true | async def test_connect(loop, key) -> None:
proto = mock.Mock()
proto.is_connected.return_value = True
req = ClientRequest("GET", URL("http://localhost:80"), loop=loop)
conn = aiohttp.BaseConnector(loop=loop)
conn._conns[key] = [(proto, loop.time())]
conn._create_connection = mock.Mock()
co... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_connect_queued_operation_tracing[pyloop] | true | async def test_connect_queued_operation_tracing(loop, key) -> None:
session = mock.Mock()
trace_config_ctx = mock.Mock()
on_connection_queued_start = mock.Mock(side_effect=make_mocked_coro(mock.Mock()))
on_connection_queued_end = mock.Mock(side_effect=make_mocked_coro(mock.Mock()))
trace_config = a... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_connect_reuseconn_tracing[pyloop] | true | async def test_connect_reuseconn_tracing(loop, key) -> None:
session = mock.Mock()
trace_config_ctx = mock.Mock()
on_connection_reuseconn = mock.Mock(side_effect=make_mocked_coro(mock.Mock()))
trace_config = aiohttp.TraceConfig(
trace_config_ctx_factory=mock.Mock(return_value=trace_config_ctx)
... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_connect_tracing[pyloop] | true | async def test_connect_tracing(loop) -> None:
session = mock.Mock()
trace_config_ctx = mock.Mock()
on_connection_create_start = mock.Mock(side_effect=make_mocked_coro(mock.Mock()))
on_connection_create_end = mock.Mock(side_effect=make_mocked_coro(mock.Mock()))
trace_config = aiohttp.TraceConfig(
... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_connect_waiters_cleanup[pyloop] | true | async def test_connect_waiters_cleanup(loop) -> None:
proto = mock.Mock()
proto.is_connected.return_value = True
req = ClientRequest("GET", URL("http://host:80"), loop=loop)
conn = aiohttp.BaseConnector(loop=loop, limit=1)
conn._available_connections = mock.Mock(return_value=0)
t = loop.creat... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_connect_waiters_cleanup_key_error[pyloop] | true | async def test_connect_waiters_cleanup_key_error(loop) -> None:
proto = mock.Mock()
proto.is_connected.return_value = True
req = ClientRequest("GET", URL("http://host:80"), loop=loop)
conn = aiohttp.BaseConnector(loop=loop, limit=1)
conn._available_connections = mock.Mock(return_value=0)
t = ... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_connect_with_capacity_release_waiters[pyloop] | true | async def test_connect_with_capacity_release_waiters(loop) -> None:
def check_with_exc(err):
conn = aiohttp.BaseConnector(limit=1, loop=loop)
conn._create_connection = mock.Mock()
conn._create_connection.return_value = loop.create_future()
conn._create_connection.return_value.set_exc... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_connect_with_limit[pyloop] | true | async def test_connect_with_limit(
loop: asyncio.AbstractEventLoop, key: ConnectionKey
) -> None:
proto = create_mocked_conn(loop)
proto.is_connected.return_value = True
req = ClientRequest(
"GET", URL("http://localhost:80"), loop=loop, response_class=mock.Mock()
)
conn = aiohttp.BaseC... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_connect_with_limit_and_limit_per_host[pyloop] | true | async def test_connect_with_limit_and_limit_per_host(loop, key) -> None:
proto = mock.Mock()
proto.is_connected.return_value = True
req = ClientRequest("GET", URL("http://localhost:80"), loop=loop)
conn = aiohttp.BaseConnector(loop=loop, limit=1000, limit_per_host=1)
conn._conns[key] = [(proto, lo... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_connect_with_limit_cancelled[pyloop] | true | async def test_connect_with_limit_cancelled(loop) -> None:
proto = mock.Mock()
proto.is_connected.return_value = True
req = ClientRequest("GET", URL("http://host:80"), loop=loop)
conn = aiohttp.BaseConnector(loop=loop, limit=1)
key = ("host", 80, False)
conn._conns[key] = [(proto, loop.time()... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_connect_with_limit_concurrent[pyloop] | true | async def test_connect_with_limit_concurrent(loop) -> None:
proto = mock.Mock()
proto.should_close = False
proto.is_connected.return_value = True
req = ClientRequest("GET", URL("http://host:80"), loop=loop)
max_connections = 2
num_connections = 0
conn = aiohttp.BaseConnector(limit=max_con... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_connect_with_no_limit_and_limit_per_host[pyloop] | true | async def test_connect_with_no_limit_and_limit_per_host(loop, key) -> None:
proto = mock.Mock()
proto.is_connected.return_value = True
req = ClientRequest("GET", URL("http://localhost1:80"), loop=loop)
conn = aiohttp.BaseConnector(loop=loop, limit=0, limit_per_host=1)
conn._conns[key] = [(proto, l... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_connect_with_no_limits[pyloop] | true | async def test_connect_with_no_limits(loop, key) -> None:
proto = mock.Mock()
proto.is_connected.return_value = True
req = ClientRequest("GET", URL("http://localhost:80"), loop=loop)
conn = aiohttp.BaseConnector(loop=loop, limit=0, limit_per_host=0)
conn._conns[key] = [(proto, loop.time())]
co... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_connection_del[pyloop] | true | def test_connection_del(loop) -> None:
connector = mock.Mock()
key = mock.Mock()
protocol = mock.Mock()
loop.set_debug(0)
conn = Connection(connector, key, protocol, loop=loop)
exc_handler = mock.Mock()
loop.set_exception_handler(exc_handler)
with pytest.warns(ResourceWarning):
... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_connection_del_loop_closed[pyloop] | true | def test_connection_del_loop_closed(loop) -> None:
connector = mock.Mock()
key = mock.Mock()
protocol = mock.Mock()
loop.set_debug(1)
conn = Connection(connector, key, protocol, loop=loop)
exc_handler = mock.Mock()
loop.set_exception_handler(exc_handler)
loop.close()
with pytest.war... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_connection_del_loop_debug[pyloop] | true | def test_connection_del_loop_debug(loop) -> None:
connector = mock.Mock()
key = mock.Mock()
protocol = mock.Mock()
loop.set_debug(1)
conn = Connection(connector, key, protocol, loop=loop)
exc_handler = mock.Mock()
loop.set_exception_handler(exc_handler)
with pytest.warns(ResourceWarning... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_connector_cache_trace_race | true | async def test_connector_cache_trace_race():
class DummyTracer:
async def send_dns_cache_hit(self, *args, **kwargs):
connector._cached_hosts.remove(("", 0))
token = object()
connector = TCPConnector()
connector._cached_hosts.add(("", 0), [token])
traces = [DummyTracer()]
as... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_connector_context_manager[pyloop] | true | async def test_connector_context_manager(loop) -> None:
conn = aiohttp.BaseConnector(loop=loop)
with pytest.warns(DeprecationWarning):
with conn as c:
assert conn is c
assert conn.closed
await conn.close()
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES/9032.bugf... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_connector_does_not_remove_needed_waiters[pyloop] | true | async def test_connector_does_not_remove_needed_waiters(loop, key) -> None:
proto = create_mocked_conn(loop)
proto.is_connected.return_value = True
req = ClientRequest("GET", URL("https://localhost:80"), loop=loop)
connection_key = req.connection_key
connector = aiohttp.BaseConnector()
connect... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_connector_multiple_event_loop | true | def test_connector_multiple_event_loop() -> None:
"""Test the connector with multiple event loops."""
async def async_connect() -> Literal[True]:
conn = aiohttp.TCPConnector()
loop = asyncio.get_running_loop()
req = ClientRequest("GET", URL("https://127.0.0.1"), loop=loop)
with ... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_connector_throttle_trace_race[pyloop] | true | async def test_connector_throttle_trace_race(loop):
key = ("", 0)
token = object()
class DummyTracer:
async def send_dns_cache_hit(self, *args, **kwargs):
event = connector._throttle_dns_events.pop(key)
event.set()
connector._cached_hosts.add(key, [token])
c... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_create_conn[pyloop] | true | async def test_create_conn(loop) -> None:
conn = aiohttp.BaseConnector(loop=loop)
with pytest.raises(NotImplementedError):
await conn._create_connection(object(), [], object())
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES/9032.bugfix.rst b/CHANGES/9032.bugfix.rst
new file mode 10064... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_ctor_cleanup | true | async def test_ctor_cleanup() -> None:
loop = mock.Mock()
loop.time.return_value = 1.5
conn = aiohttp.BaseConnector(
loop=loop, keepalive_timeout=10, enable_cleanup_closed=True
)
assert conn._cleanup_handle is None
assert conn._cleanup_closed_handle is not None
# --- pre-patch trace ---... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_ctor_with_default_loop[pyloop] | true | async def test_ctor_with_default_loop(loop) -> None:
conn = aiohttp.BaseConnector()
assert loop is conn._loop
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES/9032.bugfix.rst b/CHANGES/9032.bugfix.rst
new file mode 100644
index 000000000..8c8d81f63
--- /dev/null
+++ b/CHANGES/9032.bugfix.rst
@@... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_default_force_close[pyloop] | true | async def test_default_force_close(loop) -> None:
connector = aiohttp.BaseConnector(loop=loop)
assert not connector.force_close
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES/9032.bugfix.rst b/CHANGES/9032.bugfix.rst
new file mode 100644
index 000000000..8c8d81f63
--- /dev/null
+++ b/CHANGES/... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_default_ssl_context_creation_without_ssl | true | def test_default_ssl_context_creation_without_ssl() -> None:
"""Verify _make_ssl_context does not raise when ssl is not available."""
with mock.patch.object(connector_module, "ssl", None):
assert connector_module._make_ssl_context(False) is None
assert connector_module._make_ssl_context(True) is... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_default_use_dns_cache | true | async def test_default_use_dns_cache() -> None:
conn = aiohttp.TCPConnector()
assert conn.use_dns_cache
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES/9032.bugfix.rst b/CHANGES/9032.bugfix.rst
new file mode 100644
index 000000000..8c8d81f63
--- /dev/null
+++ b/CHANGES/9032.bugfix.rst
@@ -0,0 ... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_del[pyloop] | true | async def test_del(loop) -> None:
conn = aiohttp.BaseConnector()
proto = mock.Mock(should_close=False)
conn._release("a", proto)
conns_impl = conn._conns
exc_handler = mock.Mock()
loop.set_exception_handler(exc_handler)
with pytest.warns(ResourceWarning):
del conn
gc.collec... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_del_empty_connector[pyloop] | true | async def test_del_empty_connector(loop) -> None:
conn = aiohttp.BaseConnector(loop=loop)
exc_handler = mock.Mock()
loop.set_exception_handler(exc_handler)
del conn
assert not exc_handler.called
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES/9032.bugfix.rst b/CHANGES/9032.bugfi... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_del_with_closed_loop[pyloop] | true | @pytest.mark.skipif(
sys.implementation.name != "cpython", reason="CPython GC is required for the test"
)
def test_del_with_closed_loop(loop) -> None:
async def make_conn():
return aiohttp.BaseConnector()
conn = loop.run_until_complete(make_conn())
transp = mock.Mock()
conn._conns["a"] = [(... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_del_with_scheduled_cleanup[pyloop] | true | @pytest.mark.xfail
async def test_del_with_scheduled_cleanup(loop) -> None:
loop.set_debug(True)
conn = aiohttp.BaseConnector(loop=loop, keepalive_timeout=0.01)
transp = mock.Mock()
conn._conns["a"] = [(transp, 123)]
conns_impl = conn._conns
exc_handler = mock.Mock()
loop.set_exception_hand... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_dns_error[pyloop] | true | async def test_dns_error(loop) -> None:
connector = aiohttp.TCPConnector(loop=loop)
connector._resolve_host = make_mocked_coro(
raise_exception=OSError("dont take it serious")
)
req = ClientRequest("GET", URL("http://www.python.org"), loop=loop)
with pytest.raises(aiohttp.ClientConnectorEr... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_error_on_connection[pyloop] | true | async def test_error_on_connection(loop, key) -> None:
conn = aiohttp.BaseConnector(limit=1, loop=loop)
req = mock.Mock()
req.connection_key = key
proto = mock.Mock()
i = 0
fut = loop.create_future()
exc = OSError()
async def create_connection(req, traces, timeout):
nonlocal i... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_error_on_connection_with_cancelled_waiter[pyloop] | true | async def test_error_on_connection_with_cancelled_waiter(loop, key) -> None:
conn = aiohttp.BaseConnector(limit=1, loop=loop)
req = mock.Mock()
req.connection_key = key
proto = mock.Mock()
i = 0
fut1 = loop.create_future()
fut2 = loop.create_future()
exc = OSError()
async def crea... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_force_close_and_explicit_keep_alive[pyloop] | true | async def test_force_close_and_explicit_keep_alive(loop) -> None:
with pytest.raises(ValueError):
aiohttp.BaseConnector(loop=loop, keepalive_timeout=30, force_close=True)
conn = aiohttp.BaseConnector(loop=loop, force_close=True, keepalive_timeout=None)
assert conn
conn = aiohttp.BaseConnector(... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_get[pyloop] | true | async def test_get(loop) -> None:
conn = aiohttp.BaseConnector(loop=loop)
assert conn._get(1) is None
proto = mock.Mock()
conn._conns[1] = [(proto, loop.time())]
assert conn._get(1) == proto
await conn.close()
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES/9032.bugfix.rst b/C... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_get_expired[pyloop] | true | async def test_get_expired(loop) -> None:
conn = aiohttp.BaseConnector(loop=loop)
key = ConnectionKey("localhost", 80, False, None, None, None, None)
assert conn._get(key) is None
proto = mock.Mock()
conn._conns[key] = [(proto, loop.time() - 1000)]
assert conn._get(key) is None
assert not c... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_get_expired_ssl[pyloop] | true | async def test_get_expired_ssl(loop) -> None:
conn = aiohttp.BaseConnector(loop=loop, enable_cleanup_closed=True)
key = ConnectionKey("localhost", 80, True, None, None, None, None)
assert conn._get(key) is None
proto = mock.Mock()
transport = proto.transport
conn._conns[key] = [(proto, loop.tim... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_get_pop_empty_conns[pyloop] | true | async def test_get_pop_empty_conns(loop) -> None:
# see issue #473
conn = aiohttp.BaseConnector(loop=loop)
key = ("127.0.0.1", 80, False)
conn._conns[key] = []
proto = conn._get(key)
assert proto is None
assert not conn._conns
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_get_unconnected_proto[pyloop] | true | async def test_get_unconnected_proto(loop) -> None:
conn = aiohttp.BaseConnector()
key = ConnectionKey("localhost", 80, False, None, None, None, None)
assert conn._get(key) is None
proto = create_mocked_conn(loop)
conn._conns[key] = [(proto, loop.time())]
assert conn._get(key) == proto
ass... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_get_unconnected_proto_ssl[pyloop] | true | async def test_get_unconnected_proto_ssl(loop) -> None:
conn = aiohttp.BaseConnector()
key = ConnectionKey("localhost", 80, True, None, None, None, None)
assert conn._get(key) is None
proto = create_mocked_conn(loop)
conn._conns[key] = [(proto, loop.time())]
assert conn._get(key) == proto
... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_insecure_fingerprint_md5[pyloop] | true | async def test_insecure_fingerprint_md5(loop) -> None:
with pytest.raises(ValueError):
aiohttp.TCPConnector(
ssl=aiohttp.Fingerprint(hashlib.md5(b"foo").digest()), loop=loop
)
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES/9032.bugfix.rst b/CHANGES/9032.bugfix.rst
new ... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_insecure_fingerprint_sha1[pyloop] | true | async def test_insecure_fingerprint_sha1(loop) -> None:
with pytest.raises(ValueError):
aiohttp.TCPConnector(
ssl=aiohttp.Fingerprint(hashlib.sha1(b"foo").digest()), loop=loop
)
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES/9032.bugfix.rst b/CHANGES/9032.bugfix.rst
ne... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_invalid_ssl_param | true | async def test_invalid_ssl_param() -> None:
with pytest.raises(TypeError):
aiohttp.TCPConnector(ssl=object()) # type: ignore[arg-type]
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES/9032.bugfix.rst b/CHANGES/9032.bugfix.rst
new file mode 100644
index 000000000..8c8d81f63
--- /dev/null
++... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_limit_per_host_property[pyloop] | true | async def test_limit_per_host_property(loop) -> None:
conn = aiohttp.BaseConnector(loop=loop, limit_per_host=15)
assert 15 == conn.limit_per_host
await conn.close()
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES/9032.bugfix.rst b/CHANGES/9032.bugfix.rst
new file mode 100644
index 0000000... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_limit_per_host_property_default[pyloop] | true | async def test_limit_per_host_property_default(loop) -> None:
conn = aiohttp.BaseConnector(loop=loop)
assert conn.limit_per_host == 0
await conn.close()
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES/9032.bugfix.rst b/CHANGES/9032.bugfix.rst
new file mode 100644
index 000000000..8c8d81f63... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_limit_property[pyloop] | true | async def test_limit_property(loop) -> None:
conn = aiohttp.BaseConnector(loop=loop, limit=15)
assert 15 == conn.limit
await conn.close()
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES/9032.bugfix.rst b/CHANGES/9032.bugfix.rst
new file mode 100644
index 000000000..8c8d81f63
--- /dev/null... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_limit_property_default[pyloop] | true | async def test_limit_property_default(loop) -> None:
conn = aiohttp.BaseConnector(loop=loop)
assert conn.limit == 100
await conn.close()
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES/9032.bugfix.rst b/CHANGES/9032.bugfix.rst
new file mode 100644
index 000000000..8c8d81f63
--- /dev/null
+... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_release[pyloop] | true | async def test_release(loop, key) -> None:
conn = aiohttp.BaseConnector(loop=loop)
conn._release_waiter = mock.Mock()
proto = mock.Mock(should_close=False)
conn._acquired.add(proto)
conn._acquired_per_host[key].add(proto)
conn._release(key, proto)
assert conn._release_waiter.called
as... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_release_acquired[pyloop] | true | async def test_release_acquired(loop, key) -> None:
proto = mock.Mock()
conn = aiohttp.BaseConnector(loop=loop, limit=5)
conn._release_waiter = mock.Mock()
conn._acquired.add(proto)
conn._acquired_per_host[key].add(proto)
conn._release_acquired(key, proto)
assert 0 == len(conn._acquired)
... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_release_acquired_closed[pyloop] | true | async def test_release_acquired_closed(loop, key) -> None:
proto = mock.Mock()
conn = aiohttp.BaseConnector(loop=loop, limit=5)
conn._release_waiter = mock.Mock()
conn._acquired.add(proto)
conn._acquired_per_host[key].add(proto)
conn._closed = True
conn._release_acquired(key, proto)
ass... | custom-check-github |
aio-libs__aiohttp-9047 | tests/test_connector.py::test_release_already_closed[pyloop] | true | async def test_release_already_closed(loop) -> None:
conn = aiohttp.BaseConnector(loop=loop)
proto = mock.Mock()
key = 1
conn._acquired.add(proto)
await conn.close()
conn._release_waiters = mock.Mock()
conn._release_acquired = mock.Mock()
conn._release(key, proto)
assert not conn.... | custom-check-github |