repo_id
stringclasses
409 values
prefix
large_stringlengths
34
36.3k
target
large_stringlengths
1
498
assertion_type
stringclasses
31 values
difficulty
stringclasses
8 values
test_file
stringlengths
10
121
test_function
stringlengths
1
104
test_class
stringlengths
0
51
lineno
int32
2
11.3k
commit_idx
int32
pgjones/hypercorn
from __future__ import annotations import asyncio from typing import Any, cast from unittest.mock import AsyncMock, call, Mock import pytest import pytest_asyncio from wsproto.events import BytesMessage, TextMessage from hypercorn.asyncio.task_group import TaskGroup from hypercorn.asyncio.worker_context import Worke...
101
assert
numeric_literal
tests/protocol/test_ws_stream.py
test_handshake_accept_http1
125
null
pgjones/hypercorn
from __future__ import annotations import pytest from hypercorn.middleware import HTTPToHTTPSRedirectMiddleware from hypercorn.typing import ConnectionState, HTTPScope, WebsocketScope from ..helpers import empty_framework def test_http_to_https_redirect_new_url_header() -> None: app = HTTPToHTTPSRedirectMiddlewa...
"https://localhost/"
assert
string_literal
tests/middleware/test_http_to_https.py
test_http_to_https_redirect_new_url_header
171
null
pgjones/hypercorn
from __future__ import annotations import asyncio from typing import Any from unittest.mock import AsyncMock, call, Mock import h11 import pytest import pytest_asyncio from _pytest.monkeypatch import MonkeyPatch import hypercorn.protocol.h11 from hypercorn.asyncio.worker_context import EventWrapper from hypercorn.co...
call(Closed())
assert
func_call
tests/protocol/test_h11.py
test_protocol_keep_alive_max_requests
120
null
pgjones/hypercorn
from __future__ import annotations import asyncio import h2 import h11 import pytest import wsproto from hypercorn.app_wrappers import ASGIWrapper from hypercorn.asyncio.tcp_server import TCPServer from hypercorn.asyncio.worker_context import WorkerContext from hypercorn.config import Config from .helpers import Mem...
[ (b":status", b"200"), (b"content-length", b"15"), (b"date", b"Thu, 01 Jan 1970 01:23:20 GMT"), (b"server", b"hypercorn-h2"), ]
assert
collection
tests/asyncio/test_sanity.py
test_http2_request
170
null
pgjones/hypercorn
from __future__ import annotations import logging import os import time import pytest from hypercorn.config import Config from hypercorn.logging import AccessLogAtoms, Logger from hypercorn.typing import HTTPScope, ResponseSummary def _response_scope() -> dict: return {"status": 200, "headers": [(b"Content-Leng...
0
assert
numeric_literal
tests/test_logging.py
test_access_log_standard_atoms
81
null
pgjones/hypercorn
from __future__ import annotations import asyncio from typing import Any, cast from unittest.mock import AsyncMock, call, Mock import pytest import pytest_asyncio from wsproto.events import BytesMessage, TextMessage from hypercorn.asyncio.task_group import TaskGroup from hypercorn.asyncio.worker_context import Worke...
(TypeError, ValueError))
pytest.raises
collection
tests/protocol/test_ws_stream.py
test_send_invalid_http_message
509
null
pgjones/hypercorn
from __future__ import annotations from typing import cast from unittest.mock import AsyncMock, Mock, PropertyMock import h2 import h11 import pytest import trio import wsproto from hypercorn.app_wrappers import ASGIWrapper from hypercorn.config import Config from hypercorn.trio.tcp_server import TCPServer from hype...
[ h11.Response( status_code=200, headers=[ (b"content-length", b"15"), (b"date", b"Thu, 01 Jan 1970 01:23:20 GMT"), (b"server", b"hypercorn-h11"), (b"connection", b"close"), ], http_version=b"1.1", reason=b"", ), h11.Data(data=b"Hello & Goodbye"), h11.EndOfMessage(headers=[]), ]
assert
collection
tests/trio/test_sanity.py
test_http1_request
56
null
pgjones/hypercorn
from __future__ import annotations import asyncio from typing import Any, cast from unittest.mock import AsyncMock, call, Mock import pytest import pytest_asyncio from wsproto.events import BytesMessage, TextMessage from hypercorn.asyncio.task_group import TaskGroup from hypercorn.asyncio.worker_context import Worke...
[ # type: ignore call(Response(stream_id=1, headers=[], status_code=200)) ]
assert
collection
tests/protocol/test_ws_stream.py
test_send_accept
278
null
pgjones/hypercorn
from __future__ import annotations import os import socket import ssl import sys from unittest.mock import Mock, NonCallableMock import pytest from _pytest.monkeypatch import MonkeyPatch import hypercorn.config from hypercorn.config import Config access_log_format = "bob" h11_max_incomplete_size = 4 def _check_sta...
h11_max_incomplete_size
assert
variable
tests/test_config.py
_check_standard_config
21
null
pgjones/hypercorn
from __future__ import annotations from unittest.mock import AsyncMock import pytest from hypercorn.middleware import ProxyFixMiddleware from hypercorn.typing import ConnectionState, HTTPScope @pytest.mark.asyncio async def test_proxy_fix_legacy() -> None: mock = AsyncMock() app = ProxyFixMiddleware(mock) ...
[(b"host", b"example.com")]
assert
collection
tests/middleware/test_proxy_fix.py
test_proxy_fix_legacy
42
null
pgjones/hypercorn
from __future__ import annotations import asyncio from unittest.mock import AsyncMock, call, Mock import pytest from h2.connection import H2Connection from h2.events import ConnectionTerminated from hypercorn.asyncio.worker_context import EventWrapper, WorkerContext from hypercorn.config import Config from hypercorn...
BufferCompleteError)
pytest.raises
variable
tests/protocol/test_h2.py
test_stream_buffer_closed
59
null
pgjones/hypercorn
from __future__ import annotations import asyncio from typing import Any, cast from unittest.mock import AsyncMock, call, Mock import pytest import pytest_asyncio from wsproto.events import BytesMessage, TextMessage from hypercorn.asyncio.task_group import TaskGroup from hypercorn.asyncio.worker_context import Worke...
valid
assert
variable
tests/protocol/test_ws_stream.py
test_handshake_validity
111
null
pgjones/hypercorn
from __future__ import annotations import asyncio from collections.abc import Callable from functools import partial from typing import Any import pytest import trio from hypercorn.app_wrappers import _build_environ, InvalidPathError, WSGIWrapper from hypercorn.typing import ASGIReceiveEvent, ASGISendEvent, Connecti...
[ {"headers": [], "status": 400, "type": "http.response.start"}, {"body": bytearray(b""), "type": "http.response.body", "more_body": False}, ]
assert
collection
tests/test_app_wrappers.py
test_max_body_size
135
null
pgjones/hypercorn
from __future__ import annotations import logging import os import time import pytest from hypercorn.config import Config from hypercorn.logging import AccessLogAtoms, Logger from hypercorn.typing import HTTPScope, ResponseSummary @pytest.mark.parametrize( "target, expected_name, expected_handler_type", [ ...
[]
assert
collection
tests/test_logging.py
test_access_logger_init
37
null
pgjones/hypercorn
from __future__ import annotations import os import socket import ssl import sys from unittest.mock import Mock, NonCallableMock import pytest from _pytest.monkeypatch import MonkeyPatch import hypercorn.config from hypercorn.config import Config access_log_format = "bob" h11_max_incomplete_size = 4 def _check_sta...
"/tmp/hypercorn.sock")
assert_*
string_literal
tests/test_config.py
test_create_sockets_unix
113
null
pgjones/hypercorn
from __future__ import annotations import os import socket import ssl import sys from unittest.mock import Mock, NonCallableMock import pytest from _pytest.monkeypatch import MonkeyPatch import hypercorn.config from hypercorn.config import Config access_log_format = "bob" h11_max_incomplete_size = 4 def _check_sta...
1)
assert_*
numeric_literal
tests/test_config.py
test_create_sockets_ip
97
null
pgjones/hypercorn
from __future__ import annotations import pytest from hypercorn.middleware import HTTPToHTTPSRedirectMiddleware from hypercorn.typing import ConnectionState, HTTPScope, WebsocketScope from ..helpers import empty_framework @pytest.mark.asyncio async def test_http_to_https_redirect_middleware_websocket_http2() -> None...
[ { "type": "websocket.http.response.start", "status": 307, "headers": [(b"location", b"https://localhost/abc?a=b")], }, {"type": "websocket.http.response.body"}, ]
assert
collection
tests/middleware/test_http_to_https.py
test_http_to_https_redirect_middleware_websocket_http2
111
null
pgjones/hypercorn
from __future__ import annotations from typing import Any, cast from unittest.mock import AsyncMock, call import pytest import pytest_asyncio from hypercorn.asyncio.statsd import StatsdLogger from hypercorn.asyncio.worker_context import WorkerContext from hypercorn.config import Config from hypercorn.logging import ...
ASGIHTTPState.RESPONSE
assert
complex_expr
tests/protocol/test_http_stream.py
test_send_response
162
null
pgjones/hypercorn
from __future__ import annotations import inspect import os from unittest.mock import Mock import pytest from _pytest.monkeypatch import MonkeyPatch import hypercorn.__main__ from hypercorn.config import Config @pytest.mark.parametrize( "flag, set_value, config_key", [ ("--access-logformat", "jeff",...
getattr(config, name)
assert
func_call
tests/test___main__.py
test_main_cli_override
73
null
pgjones/hypercorn
from __future__ import annotations import asyncio from collections.abc import Callable import pytest from hypercorn.app_wrappers import ASGIWrapper from hypercorn.asyncio.task_group import TaskGroup from hypercorn.config import Config from hypercorn.typing import HTTPScope, Scope @pytest.mark.asyncio async def test...
None
assert
none_literal
tests/asyncio/test_task_group.py
test_spawn_app_error
45
null
pgjones/hypercorn
from __future__ import annotations import asyncio from typing import Any from unittest.mock import AsyncMock, call, Mock import h11 import pytest import pytest_asyncio from _pytest.monkeypatch import MonkeyPatch import hypercorn.protocol.h11 from hypercorn.asyncio.worker_context import EventWrapper from hypercorn.co...
[ # type: ignore call( RawData( data=b"HTTP/1.1 400 \r\ncontent-length: 0\r\nconnection: close\r\n" b"date: Thu, 01 Jan 1970 01:23:20 GMT\r\nserver: hypercorn-h11\r\n\r\n" ) ), call(RawData(data=b"")), call(Closed()), ]
assert
collection
tests/protocol/test_h11.py
test_protocol_handle_protocol_error
251
null
pgjones/hypercorn
from __future__ import annotations from collections.abc import Callable, Iterable from typing import Any import pytest from hypercorn.typing import Scope from hypercorn.utils import ( build_and_validate_headers, filter_pseudo_headers, is_asgi, suppress_body, ) async def asgi_callable(scope: Scope, r...
TypeError)
pytest.raises
variable
tests/test_utils.py
test_build_and_validate_headers_validate
62
null
pgjones/hypercorn
from __future__ import annotations import asyncio from collections.abc import Callable from functools import partial from typing import Any import pytest import trio from hypercorn.app_wrappers import _build_environ, InvalidPathError, WSGIWrapper from hypercorn.typing import ASGIReceiveEvent, ASGISendEvent, Connecti...
InvalidPathError)
pytest.raises
variable
tests/test_app_wrappers.py
test_build_environ_root_path
207
null
pgjones/hypercorn
from __future__ import annotations import asyncio from typing import Any from unittest.mock import AsyncMock, call, Mock import h11 import pytest import pytest_asyncio from _pytest.monkeypatch import MonkeyPatch import hypercorn.protocol.h11 from hypercorn.asyncio.worker_context import EventWrapper from hypercorn.co...
[ # type: ignore call(Updated(idle=False)), call( RawData( b"HTTP/1.1 101 \r\n" b"date: Thu, 01 Jan 1970 01:23:20 GMT\r\n" b"server: hypercorn-h11\r\n" b"connection: upgrade\r\n" b"upgrade: h2c\r\n" b"\r\n" ) ), ]
assert
collection
tests/protocol/test_h11.py
test_protocol_handle_h2c_upgrade
353
null
pgjones/hypercorn
from __future__ import annotations import asyncio from typing import Any from unittest.mock import AsyncMock, call, Mock import h11 import pytest import pytest_asyncio from _pytest.monkeypatch import MonkeyPatch import hypercorn.protocol.h11 from hypercorn.asyncio.worker_context import EventWrapper from hypercorn.co...
H2CProtocolRequiredError)
pytest.raises
variable
tests/protocol/test_h11.py
test_protocol_handle_h2c_upgrade
344
null
pgjones/hypercorn
from __future__ import annotations import asyncio from unittest.mock import AsyncMock, call, Mock import pytest from h2.connection import H2Connection from h2.events import ConnectionTerminated from hypercorn.asyncio.worker_context import EventWrapper, WorkerContext from hypercorn.config import Config from hypercorn...
True
assert
bool_literal
tests/protocol/test_h2.py
test_stream_buffer_push_and_pop
32
null
pgjones/hypercorn
from __future__ import annotations from typing import Any, cast from unittest.mock import AsyncMock, call import pytest import pytest_asyncio from hypercorn.asyncio.statsd import StatsdLogger from hypercorn.asyncio.worker_context import WorkerContext from hypercorn.config import Config from hypercorn.logging import ...
[ # type: ignore call({"type": "http.request", "body": b"data", "more_body": True}) ]
assert
collection
tests/protocol/test_http_stream.py
test_handle_body
115
null
pgjones/hypercorn
from __future__ import annotations import asyncio from typing import Any from unittest.mock import AsyncMock, call, Mock import h11 import pytest import pytest_asyncio from _pytest.monkeypatch import MonkeyPatch import hypercorn.protocol.h11 from hypercorn.asyncio.worker_context import EventWrapper from hypercorn.co...
b"abcd"
assert
string_literal
tests/protocol/test_h11.py
test_protocol_handle_h2c_upgrade
375
null
pgjones/hypercorn
from __future__ import annotations import sys import pytest import trio from hypercorn.app_wrappers import ASGIWrapper from hypercorn.config import Config from hypercorn.trio.lifespan import Lifespan from hypercorn.typing import ASGIReceiveCallable, ASGISendCallable, Scope from hypercorn.utils import LifespanFailure...
LifespanTimeoutError)
pytest.raises
variable
tests/trio/test_lifespan.py
test_startup_timeout_error
25
null
pgjones/hypercorn
from __future__ import annotations import os import socket import ssl import sys from unittest.mock import Mock, NonCallableMock import pytest from _pytest.monkeypatch import MonkeyPatch import hypercorn.config from hypercorn.config import Config access_log_format = "bob" h11_max_incomplete_size = 4 def _check_sta...
2
assert
numeric_literal
tests/test_config.py
test_create_sockets_multiple
143
null
pgjones/hypercorn
from __future__ import annotations import asyncio from typing import Any from unittest.mock import AsyncMock, call, Mock import h11 import pytest import pytest_asyncio from _pytest.monkeypatch import MonkeyPatch import hypercorn.protocol.h11 from hypercorn.asyncio.worker_context import EventWrapper from hypercorn.co...
call(expected)
assert
func_call
tests/protocol/test_h11.py
test_protocol_send_stream_closed
138
null
pgjones/hypercorn
from __future__ import annotations import os import socket import ssl import sys from unittest.mock import Mock, NonCallableMock import pytest from _pytest.monkeypatch import MonkeyPatch import hypercorn.config from hypercorn.config import Config access_log_format = "bob" h11_max_incomplete_size = 4 def _check_sta...
["127.0.0.1:5555"]
assert
collection
tests/test_config.py
_check_standard_config
22
null
pgjones/hypercorn
from __future__ import annotations import inspect import os from unittest.mock import Mock import pytest from _pytest.monkeypatch import MonkeyPatch import hypercorn.__main__ from hypercorn.config import Config @pytest.mark.parametrize( "flag, set_value, config_key", [ ("--access-logformat", "jeff",...
set_value
assert
variable
tests/test___main__.py
test_main_cli_override
74
null
pgjones/hypercorn
from __future__ import annotations from typing import Any, cast from unittest.mock import AsyncMock, call import pytest import pytest_asyncio from hypercorn.asyncio.statsd import StatsdLogger from hypercorn.asyncio.worker_context import WorkerContext from hypercorn.config import Config from hypercorn.logging import ...
[ # type: ignore call( Request( stream_id=1, headers=[(b":scheme", b"https")], http_version="2", method="GET", raw_path=b"/push", state=ConnectionState({}), ) ) ]
assert
collection
tests/protocol/test_http_stream.py
test_send_push
209
null
pgjones/hypercorn
from __future__ import annotations import pytest from hypercorn.middleware import HTTPToHTTPSRedirectMiddleware from hypercorn.typing import ConnectionState, HTTPScope, WebsocketScope from ..helpers import empty_framework @pytest.mark.asyncio @pytest.mark.parametrize("raw_path", [b"/abc", b"/abc%3C"]) async def test...
[ { "type": "http.response.start", "status": 307, "headers": [(b"location", b"https://localhost%s?a=b" % raw_path)], }, {"type": "http.response.body"}, ]
assert
collection
tests/middleware/test_http_to_https.py
test_http_to_https_redirect_middleware_http
38
null
pgjones/hypercorn
from __future__ import annotations from typing import Any, cast from unittest.mock import AsyncMock, call import pytest import pytest_asyncio from hypercorn.asyncio.statsd import StatsdLogger from hypercorn.asyncio.worker_context import WorkerContext from hypercorn.config import Config from hypercorn.logging import ...
[ call({"type": "http.request", "body": b"", "more_body": False}) ]
assert
collection
tests/protocol/test_http_stream.py
test_handle_end_body
125
null
pgjones/hypercorn
from __future__ import annotations from collections.abc import Callable from copy import deepcopy from json import dumps from socket import AF_INET from typing import cast from hypercorn.typing import ASGIReceiveCallable, ASGISendCallable, Scope, WWWScope SANITY_BODY = b"Hello Hypercorn" async def empty_framework(s...
scope
assert
variable
tests/helpers.py
sanity_framework
87
null
pgjones/hypercorn
from __future__ import annotations from typing import Any, cast from unittest.mock import AsyncMock, call import pytest import pytest_asyncio from hypercorn.asyncio.statsd import StatsdLogger from hypercorn.asyncio.worker_context import WorkerContext from hypercorn.config import Config from hypercorn.logging import ...
{ "type": "http", "http_version": http_version, "asgi": {"spec_version": "2.1", "version": "3.0"}, "method": "GET", "scheme": "http", "path": "/", "raw_path": b"/", "query_string": b"a=b", "root_path": stream.config.root_path, "headers": [], "client": None, "server": None, "extensions": {}, "state": ConnectionState({})...
assert
collection
tests/protocol/test_http_stream.py
test_handle_request_http_1
57
null
pgjones/hypercorn
from __future__ import annotations from typing import cast from unittest.mock import AsyncMock, Mock, PropertyMock import h2 import h11 import pytest import trio import wsproto from hypercorn.app_wrappers import ASGIWrapper from hypercorn.config import Config from hypercorn.trio.tcp_server import TCPServer from hype...
[ wsproto.events.AcceptConnection( extra_headers=[ (b"date", b"Thu, 01 Jan 1970 01:23:20 GMT"), (b"server", b"hypercorn-h11"), ] ) ]
assert
collection
tests/trio/test_sanity.py
test_http1_websocket
85
null
pgjones/hypercorn
from __future__ import annotations import asyncio from typing import Any, cast from unittest.mock import AsyncMock, call, Mock import pytest import pytest_asyncio from wsproto.events import BytesMessage, TextMessage from hypercorn.asyncio.task_group import TaskGroup from hypercorn.asyncio.worker_context import Worke...
[ # type: ignore call({"type": "websocket.disconnect", "code": 1006}) ]
assert
collection
tests/protocol/test_ws_stream.py
test_handle_closed
258
null
pgjones/hypercorn
from __future__ import annotations import asyncio from collections.abc import Callable from functools import partial from typing import Any import pytest import trio from hypercorn.app_wrappers import _build_environ, InvalidPathError, WSGIWrapper from hypercorn.typing import ASGIReceiveEvent, ASGISendEvent, Connecti...
[ { "headers": [(b"content-type", b"text/plain; charset=utf-8"), (b"content-length", b"0")], "status": 200, "type": "http.response.start", }, {"body": bytearray(b""), "type": "http.response.body", "more_body": True}, {"body": bytearray(b""), "type": "http.response.body", "more_body": False}, ]
assert
collection
tests/test_app_wrappers.py
test_wsgi_trio
54
null
pgjones/hypercorn
from __future__ import annotations import asyncio import h2 import h11 import pytest import wsproto from hypercorn.app_wrappers import ASGIWrapper from hypercorn.asyncio.tcp_server import TCPServer from hypercorn.asyncio.worker_context import WorkerContext from hypercorn.config import Config from .helpers import Mem...
[ (b":status", b"200"), (b"date", b"Thu, 01 Jan 1970 01:23:20 GMT"), (b"server", b"hypercorn-h2"), ]
assert
collection
tests/asyncio/test_sanity.py
test_http2_websocket
218
null
pgjones/hypercorn
from __future__ import annotations import logging import os import time import pytest from hypercorn.config import Config from hypercorn.logging import AccessLogAtoms, Logger from hypercorn.typing import HTTPScope, ResponseSummary def _response_scope() -> dict: return {"status": 200, "headers": [(b"Content-Leng...
"Environ"
assert
string_literal
tests/test_logging.py
test_access_log_environ_atoms
110
null
pgjones/hypercorn
from __future__ import annotations import asyncio from typing import Any, cast from unittest.mock import AsyncMock, call, Mock import pytest import pytest_asyncio from wsproto.events import BytesMessage, TextMessage from hypercorn.asyncio.task_group import TaskGroup from hypercorn.asyncio.worker_context import Worke...
{"type": "websocket.receive", "bytes": None, "text": "abc"}
assert
collection
tests/protocol/test_ws_stream.py
test_buffer
37
null
pgjones/hypercorn
from __future__ import annotations import asyncio import pytest from hypercorn.app_wrappers import ASGIWrapper from hypercorn.asyncio.tcp_server import TCPServer from hypercorn.asyncio.worker_context import WorkerContext from hypercorn.config import Config from .helpers import MemoryReader, MemoryWriter from ..helpe...
b"HTTP/1.1 200 \r\ncontent-length: 348\r\ndate: Thu, 01 Jan 1970 01:23:20 GMT\r\nserver: hypercorn-h11\r\n\r\n"
assert
string_literal
tests/asyncio/test_tcp_server.py
test_complets_on_half_close
52
null
pgjones/hypercorn
from __future__ import annotations from collections.abc import Callable from copy import deepcopy from json import dumps from socket import AF_INET from typing import cast from hypercorn.typing import ASGIReceiveCallable, ASGISendCallable, Scope, WWWScope SANITY_BODY = b"Hello Hypercorn" async def empty_framework(s...
SANITY_BODY
assert
variable
tests/helpers.py
sanity_framework
95
null
pgjones/hypercorn
from __future__ import annotations from unittest.mock import AsyncMock import pytest from hypercorn.middleware import ProxyFixMiddleware from hypercorn.typing import ConnectionState, HTTPScope @pytest.mark.asyncio async def test_proxy_fix_legacy() -> None: mock = AsyncMock() app = ProxyFixMiddleware(mock) ...
"https"
assert
string_literal
tests/middleware/test_proxy_fix.py
test_proxy_fix_legacy
40
null
pgjones/hypercorn
from __future__ import annotations from typing import Any, cast from unittest.mock import AsyncMock, call import pytest import pytest_asyncio from hypercorn.asyncio.statsd import StatsdLogger from hypercorn.asyncio.worker_context import WorkerContext from hypercorn.config import Config from hypercorn.logging import ...
UnexpectedMessageError)
pytest.raises
variable
tests/protocol/test_http_stream.py
test_send_invalid_message_given_state
347
null
pgjones/hypercorn
from __future__ import annotations import asyncio from typing import Any from unittest.mock import AsyncMock, call, Mock import h11 import pytest import pytest_asyncio from _pytest.monkeypatch import MonkeyPatch import hypercorn.protocol.h11 from hypercorn.asyncio.worker_context import EventWrapper from hypercorn.co...
[ # type: ignore call( RawData( data=( b"HTTP/1.1 201 \r\ndate: Thu, 01 Jan 1970 01:23:20 GMT\r\n" b"server: hypercorn-h11\r\nConnection: close\r\n\r\n" ) ) ) ]
assert
collection
tests/protocol/test_h11.py
test_protocol_send_response
52
null
pgjones/hypercorn
from __future__ import annotations from typing import Any, cast from unittest.mock import AsyncMock, call import pytest import pytest_asyncio from hypercorn.asyncio.statsd import StatsdLogger from hypercorn.asyncio.worker_context import WorkerContext from hypercorn.config import Config from hypercorn.logging import ...
[ # type: ignore call(Response(stream_id=1, headers=[], status_code=200)), call(Body(stream_id=1, data=b"Body")), call(Trailers(stream_id=1, headers=[(b"X", b"V")])), call(EndBody(stream_id=1)), call(StreamClosed(stream_id=1)), ]
assert
collection
tests/protocol/test_http_stream.py
test_send_trailers
263
null
pgjones/hypercorn
from __future__ import annotations import asyncio from typing import Any from unittest.mock import AsyncMock, call, Mock import h11 import pytest import pytest_asyncio from _pytest.monkeypatch import MonkeyPatch import hypercorn.protocol.h11 from hypercorn.asyncio.worker_context import EventWrapper from hypercorn.co...
b"bbb"
assert
string_literal
tests/protocol/test_h11.py
test_protocol_handle_h2c_upgrade
366
null
pgjones/hypercorn
from __future__ import annotations from typing import cast from unittest.mock import AsyncMock, Mock, PropertyMock import h2 import h11 import pytest import trio import wsproto from hypercorn.app_wrappers import ASGIWrapper from hypercorn.config import Config from hypercorn.trio.tcp_server import TCPServer from hype...
[wsproto.events.CloseConnection(code=1000, reason="")]
assert
collection
tests/trio/test_sanity.py
test_http1_websocket
98
null
pgjones/hypercorn
from __future__ import annotations import os import socket import ssl import sys from unittest.mock import Mock, NonCallableMock import pytest from _pytest.monkeypatch import MonkeyPatch import hypercorn.config from hypercorn.config import Config access_log_format = "bob" h11_max_incomplete_size = 4 def _check_sta...
access_log_format
assert
variable
tests/test_config.py
_check_standard_config
20
null
pgjones/hypercorn
from __future__ import annotations import asyncio from typing import Any from unittest.mock import AsyncMock, call, Mock import h11 import pytest import pytest_asyncio from _pytest.monkeypatch import MonkeyPatch import hypercorn.protocol.h11 from hypercorn.asyncio.worker_context import EventWrapper from hypercorn.co...
H2ProtocolAssumedError)
pytest.raises
variable
tests/protocol/test_h11.py
test_protocol_handle_h2_prior
380
null
pgjones/hypercorn
from __future__ import annotations from collections.abc import Callable, Iterable from typing import Any import pytest from hypercorn.typing import Scope from hypercorn.utils import ( build_and_validate_headers, filter_pseudo_headers, is_asgi, suppress_body, ) async def asgi_callable(scope: Scope, r...
ValueError)
pytest.raises
variable
tests/test_utils.py
test_build_and_validate_headers_pseudo
67
null
pgjones/hypercorn
from __future__ import annotations import asyncio from typing import Any from unittest.mock import AsyncMock, call, Mock import h11 import pytest import pytest_asyncio from _pytest.monkeypatch import MonkeyPatch import hypercorn.protocol.h11 from hypercorn.asyncio.worker_context import EventWrapper from hypercorn.co...
b"PRI * HTTP/2.0\r\n\r\nbbb"
assert
string_literal
tests/protocol/test_h11.py
test_protocol_handle_h2_prior
383
null
pgjones/hypercorn
from __future__ import annotations import asyncio from typing import Any from unittest.mock import AsyncMock, call, Mock import h11 import pytest import pytest_asyncio from _pytest.monkeypatch import MonkeyPatch import hypercorn.protocol.h11 from hypercorn.asyncio.worker_context import EventWrapper from hypercorn.co...
None
assert
none_literal
tests/protocol/test_h11.py
test_protocol_instant_recycle
153
null
pgjones/hypercorn
from __future__ import annotations import logging import os import time import pytest from hypercorn.config import Config from hypercorn.logging import AccessLogAtoms, Logger from hypercorn.typing import HTTPScope, ResponseSummary @pytest.mark.parametrize( "target, expected_name, expected_handler_type", [ ...
None
assert
none_literal
tests/test_logging.py
test_access_logger_init
35
null
pgjones/hypercorn
from __future__ import annotations import asyncio from typing import Any from unittest.mock import AsyncMock, call, Mock import h11 import pytest import pytest_asyncio from _pytest.monkeypatch import MonkeyPatch import hypercorn.protocol.h11 from hypercorn.asyncio.worker_context import EventWrapper from hypercorn.co...
RawData( # type: ignore data=b"HTTP/1.1 100 \r\ndate: Thu, 01 Jan 1970 01:23:20 GMT\r\nserver: hypercorn-h11\r\n\r\n" # noqa: E501 )
assert
func_call
tests/protocol/test_h11.py
test_protocol_handle_continue_request
303
null
pgjones/hypercorn
from __future__ import annotations import os import socket import ssl import sys from unittest.mock import Mock, NonCallableMock import pytest from _pytest.monkeypatch import MonkeyPatch import hypercorn.config from hypercorn.config import Config access_log_format = "bob" h11_max_incomplete_size = 4 def _check_sta...
socket.SOCK_STREAM)
assert_*
complex_expr
tests/test_config.py
test_create_sockets_ip
96
null
pgjones/hypercorn
from __future__ import annotations from typing import Any, cast from unittest.mock import AsyncMock, call import pytest import pytest_asyncio from hypercorn.asyncio.statsd import StatsdLogger from hypercorn.asyncio.worker_context import WorkerContext from hypercorn.config import Config from hypercorn.logging import ...
[ # type: ignore call( Response( stream_id=1, headers=[(b"content-length", b"0"), (b"connection", b"close")], status_code=404, ) ), call(EndBody(stream_id=1)), ]
assert
collection
tests/protocol/test_http_stream.py
test_invalid_server_name
190
null
pgjones/hypercorn
from __future__ import annotations import asyncio from collections.abc import Callable from functools import partial from typing import Any import pytest import trio from hypercorn.app_wrappers import _build_environ, InvalidPathError, WSGIWrapper from hypercorn.typing import ASGIReceiveEvent, ASGISendEvent, Connecti...
RuntimeError)
pytest.raises
variable
tests/test_app_wrappers.py
test_no_start_response
164
null
pgjones/hypercorn
from __future__ import annotations import asyncio from typing import Any from unittest.mock import AsyncMock, call, Mock import h11 import pytest import pytest_asyncio from _pytest.monkeypatch import MonkeyPatch import hypercorn.protocol.h11 from hypercorn.asyncio.worker_context import EventWrapper from hypercorn.co...
[call(RawData(data=b"hello"))]
assert
collection
tests/protocol/test_h11.py
test_protocol_send_data
87
null
pgjones/hypercorn
from __future__ import annotations from collections.abc import Callable, Iterable from typing import Any import pytest from hypercorn.typing import Scope from hypercorn.utils import ( build_and_validate_headers, filter_pseudo_headers, is_asgi, suppress_body, ) @pytest.mark.parametrize( "method, ...
expected
assert
variable
tests/test_utils.py
test_suppress_body
21
null
pgjones/hypercorn
from __future__ import annotations from typing import Any, cast from unittest.mock import AsyncMock, call import pytest import pytest_asyncio from hypercorn.asyncio.statsd import StatsdLogger from hypercorn.asyncio.worker_context import WorkerContext from hypercorn.config import Config from hypercorn.logging import ...
{ "type": "http", "http_version": "2", "asgi": {"spec_version": "2.1", "version": "3.0"}, "method": "GET", "scheme": "http", "path": "/", "raw_path": b"/", "query_string": b"a=b", "root_path": stream.config.root_path, "headers": [], "client": None, "server": None, "extensions": { "http.response.trailers": {}, "http.res...
assert
collection
tests/protocol/test_http_stream.py
test_handle_request_http_2
89
null
pgjones/hypercorn
from __future__ import annotations import inspect import os from unittest.mock import Mock import pytest from _pytest.monkeypatch import MonkeyPatch import hypercorn.__main__ from hypercorn.config import Config def test_verify_mode_conversion(monkeypatch: MonkeyPatch) -> None: run_multiple = Mock() monkeypa...
SystemExit)
pytest.raises
variable
tests/test___main__.py
test_verify_mode_conversion
81
null
pgjones/hypercorn
from __future__ import annotations from typing import cast from unittest.mock import AsyncMock, Mock, PropertyMock import h2 import h11 import pytest import trio import wsproto from hypercorn.app_wrappers import ASGIWrapper from hypercorn.config import Config from hypercorn.trio.tcp_server import TCPServer from hype...
[ (b":status", b"200"), (b"date", b"Thu, 01 Jan 1970 01:23:20 GMT"), (b"server", b"hypercorn-h2"), ]
assert
collection
tests/trio/test_sanity.py
test_http2_websocket
191
null
pgjones/hypercorn
from __future__ import annotations import asyncio from typing import Any, cast from unittest.mock import AsyncMock, call, Mock import pytest import pytest_asyncio from wsproto.events import BytesMessage, TextMessage from hypercorn.asyncio.task_group import TaskGroup from hypercorn.asyncio.worker_context import Worke...
FrameTooLargeError)
pytest.raises
variable
tests/protocol/test_ws_stream.py
test_buffer_frame_too_large
45
null
pgjones/hypercorn
from __future__ import annotations from typing import Any, cast from unittest.mock import AsyncMock, call import pytest import pytest_asyncio from hypercorn.asyncio.statsd import StatsdLogger from hypercorn.asyncio.worker_context import WorkerContext from hypercorn.config import Config from hypercorn.logging import ...
False
assert
bool_literal
tests/protocol/test_http_stream.py
test_stream_idle
382
null
pgjones/hypercorn
from __future__ import annotations import sys import pytest import trio from hypercorn.app_wrappers import ASGIWrapper from hypercorn.config import Config from hypercorn.trio.lifespan import Lifespan from hypercorn.typing import ASGIReceiveCallable, ASGISendCallable, Scope from hypercorn.utils import LifespanFailure...
None
assert
none_literal
tests/trio/test_lifespan.py
test_startup_failure
49
null
pgjones/hypercorn
from __future__ import annotations import os import socket import ssl import sys from unittest.mock import Mock, NonCallableMock import pytest from _pytest.monkeypatch import MonkeyPatch import hypercorn.config from hypercorn.config import Config access_log_format = "bob" h11_max_incomplete_size = 4 def _check_sta...
context.options
assert
complex_expr
tests/test_config.py
test_create_ssl_context
62
null
pgjones/hypercorn
from __future__ import annotations import os import socket import ssl import sys from unittest.mock import Mock, NonCallableMock import pytest from _pytest.monkeypatch import MonkeyPatch import hypercorn.config from hypercorn.config import Config access_log_format = "bob" h11_max_incomplete_size = 4 def _check_sta...
False)
assert_*
bool_literal
tests/test_config.py
test_create_sockets_ip
99
null
pgjones/hypercorn
from __future__ import annotations from typing import Any, cast from unittest.mock import AsyncMock, call import pytest import pytest_asyncio from hypercorn.asyncio.statsd import StatsdLogger from hypercorn.asyncio.worker_context import WorkerContext from hypercorn.config import Config from hypercorn.logging import ...
[ # type: ignore call( Response( stream_id=1, headers=[(b"content-length", b"0"), (b"connection", b"close")], status_code=500, ) ), call(EndBody(stream_id=1)), call(StreamClosed(stream_id=1)), ]
assert
collection
tests/protocol/test_http_stream.py
test_send_app_error
316
null
explosion/spacy-llm
from pathlib import Path import pytest import spacy import srsly from confection import Config from spacy.tokens import Span from spacy.training import Example from spacy.util import make_tempdir from spacy_llm.pipeline import LLMWrapper from spacy_llm.registry import fewshot_reader, lowercase_normalizer, strip_norma...
set()
assert
func_call
spacy_llm/tests/tasks/legacy/test_spancat.py
test_spancat_init
563
null
explosion/spacy-llm
import copy import os import re import time from pathlib import Path from typing import Dict, Iterable, Optional, Tuple import pytest import spacy import srsly # type: ignore[import] from spacy.language import Language from spacy.tokens import Doc, DocBin from ..cache import BatchCache from ..registry import registr...
n
assert
variable
spacy_llm/tests/test_cache.py
test_caching
61
null
explosion/spacy-llm
import re from pathlib import Path import pytest import spacy from confection import Config from spacy.util import make_tempdir from spacy_llm.pipeline import LLMWrapper from spacy_llm.registry import fewshot_reader, file_reader from spacy_llm.ty import ShardingLLMTask from spacy_llm.util import assemble_from_config ...
len(doc._.summary)
assert
func_call
spacy_llm/tests/tasks/test_summarization.py
test_summarization_predict
190
null
explosion/spacy-llm
from pathlib import Path import pytest import spacy from confection import Config from spacy.tokens import Doc from spacy.training import Example from spacy.util import make_tempdir from spacy_llm.registry import fewshot_reader, file_reader from spacy_llm.tasks.lemma import LemmaTask from spacy_llm.util import assemb...
n_prompt_examples
assert
variable
spacy_llm/tests/tasks/test_lemma.py
test_lemma_init
377
null
explosion/spacy-llm
from pathlib import Path import pytest import spacy import srsly from confection import Config from spacy.tokens import Span from spacy.training import Example from spacy.util import make_tempdir from spacy_llm.pipeline import LLMWrapper from spacy_llm.registry import fewshot_reader, lowercase_normalizer, strip_norma...
dict()
assert
func_call
spacy_llm/tests/tasks/legacy/test_spancat.py
test_spancat_serde
600
null
explosion/spacy-llm
import json import re from pathlib import Path from typing import Callable, List, Tuple, cast import pytest import spacy import srsly from confection import Config from spacy.language import Language from spacy.tokens import Span from spacy.training import Example from spacy.util import make_tempdir from spacy_llm.co...
1
assert
numeric_literal
spacy_llm/tests/tasks/test_ner.py
test_ner_to_disk
814
null
explosion/spacy-llm
from pathlib import Path import numpy import pytest import spacy from confection import Config from spacy.training import Example from spacy.util import make_tempdir from spacy_llm.registry import fewshot_reader, file_reader from ...tasks import make_sentiment_task from ..compat import has_openai_key EXAMPLES_DIR =...
1.0
assert
numeric_literal
spacy_llm/tests/tasks/test_sentiment.py
test_sentiment_predict
136
null
explosion/spacy-llm
from pathlib import Path from typing import Callable, List, Tuple, cast import pytest import spacy from confection import Config from spacy.language import Language from spacy.tokens import Span from spacy.training import Example from spacy.util import make_tempdir from spacy_llm.pipeline import LLMWrapper from spacy...
task2._label_dict
assert
complex_expr
spacy_llm/tests/tasks/test_spancat.py
test_spancat_serde
626
null
explosion/spacy-llm
import copy import os import re import time from pathlib import Path from typing import Dict, Iterable, Optional, Tuple import pytest import spacy import srsly # type: ignore[import] from spacy.language import Language from spacy.tokens import Doc, DocBin from ..cache import BatchCache from ..registry import registr...
hash(llm._task.prompt_template)
assert
func_call
spacy_llm/tests/test_cache.py
test_prompt_template_handling
200
null
explosion/spacy-llm
from pathlib import Path import pytest import spacy from confection import Config from spacy.util import make_tempdir from spacy_llm.registry import fewshot_reader, file_reader from ...tasks import make_sentiment_task, make_translation_task from ..compat import has_openai_key EXAMPLES_DIR = Path(__file__).parent / ...
f""" Text: {text} Translation:""".strip()
assert
string_literal
spacy_llm/tests/tasks/test_translation.py
test_external_template_actually_loads
307
null
explosion/spacy-llm
import re import pytest from spacy_llm.models.rest.anthropic import Anthropic, Endpoints from ..compat import has_anthropic_key @pytest.mark.external @pytest.mark.skipif(has_anthropic_key is False, reason="Anthropic API key unavailable") def test_anthropic_error_unsupported_model(): """Ensure graceful handling ...
ValueError, match=re.escape( "Ensure that the selected model (x-gpt-3.5-turbo) is supported by the API" ))
pytest.raises
func_call
spacy_llm/tests/models/test_anthropic.py
test_anthropic_error_unsupported_model
62
null
explosion/spacy-llm
import json from pathlib import Path import pytest from confection import Config from pytest import FixtureRequest from spacy.tokens import Doc, Span from spacy.training import Example from spacy.util import get_lang_class from spacy_llm.pipeline import LLMWrapper from spacy_llm.tasks.rel import DEFAULT_REL_TEMPLATE,...
["ner", "llm"]
assert
collection
spacy_llm/tests/tasks/test_rel.py
test_rel_config
121
null
explosion/spacy-llm
import copy import pytest import spacy from confection import Config # type: ignore[import] from thinc.compat import has_torch_cuda_gpu from ...compat import torch _PIPE_CFG = { "model": { "@llm_models": "spacy.OpenLLaMA.v1", "name": "open_llama_3b", }, "task": {"@llm_tasks": "spacy.NoOp...
["llm"]
assert
collection
spacy_llm/tests/models/test_openllama.py
test_init_from_config
73
null
explosion/spacy-llm
import json import re from pathlib import Path import pytest import spacy import srsly from confection import Config from spacy.tokens import Span from spacy.training import Example from spacy.util import make_tempdir from spacy_llm.pipeline import LLMWrapper from spacy_llm.registry import fewshot_reader, file_reader...
2
assert
numeric_literal
spacy_llm/tests/tasks/legacy/test_ner.py
test_label_inconsistency
872
null
explosion/spacy-llm
import json from pathlib import Path import pytest from confection import Config from pytest import FixtureRequest from spacy.tokens import Doc, Span from spacy.training import Example from spacy.util import get_lang_class from spacy_llm.pipeline import LLMWrapper from spacy_llm.tasks.rel import DEFAULT_REL_TEMPLATE,...
list(task.labels)
assert
func_call
spacy_llm/tests/tasks/test_rel.py
test_rel_config
133
null
explosion/spacy-llm
import copy import os import re import time from pathlib import Path from typing import Dict, Iterable, Optional, Tuple import pytest import spacy import srsly # type: ignore[import] from spacy.language import Language from spacy.tokens import Doc, DocBin from ..cache import BatchCache from ..registry import registr...
1
assert
numeric_literal
spacy_llm/tests/test_cache.py
test_caching_llm_io
178
null
explosion/spacy-llm
import csv import functools from pathlib import Path import numpy import pytest import spacy import srsly from confection import Config from spacy import Vocab from spacy.kb import InMemoryLookupKB from spacy.pipeline import EntityLinker from spacy.tokens import Doc, Span from spacy.training import Example from spacy....
doc.text
assert
complex_expr
spacy_llm/tests/tasks/test_entity_linker.py
test_ent_unhighlighting
714
null
explosion/spacy-llm
import logging import sys import warnings from pathlib import Path from typing import Any, Dict, Iterable, Optional, Tuple import pytest import spacy import srsly from confection import Config from spacy.language import Language from spacy.tokens import Doc from spacy.util import make_tempdir from thinc.api import Num...
""
assert
string_literal
spacy_llm/tests/pipeline/test_llm.py
test_llm_logs_default_null_handler
236
null
explosion/spacy-llm
import logging import sys import warnings from pathlib import Path from typing import Any, Dict, Iterable, Optional, Tuple import pytest import spacy import srsly from confection import Config from spacy.language import Language from spacy.tokens import Doc from spacy.util import make_tempdir from thinc.api import Num...
2
assert
numeric_literal
spacy_llm/tests/pipeline/test_llm.py
test_llm_pipe
72
null
explosion/spacy-llm
from pathlib import Path import pytest import spacy import srsly from confection import Config from spacy.tokens import Span from spacy.training import Example from spacy.util import make_tempdir from spacy_llm.pipeline import LLMWrapper from spacy_llm.registry import fewshot_reader, lowercase_normalizer, strip_norma...
task.labels
assert
complex_expr
spacy_llm/tests/tasks/legacy/test_spancat.py
test_spancat_config
95
null
explosion/spacy-llm
import json from pathlib import Path import pytest from confection import Config from pytest import FixtureRequest from spacy.tokens import Doc, Span from spacy.training import Example from spacy.util import get_lang_class from spacy_llm.pipeline import LLMWrapper from spacy_llm.tasks.rel import DEFAULT_REL_TEMPLATE,...
{"LivesIn", "Visits"}
assert
collection
spacy_llm/tests/tasks/test_rel.py
test_rel_init
193
null
explosion/spacy-llm
import json import re from pathlib import Path from typing import Callable, List, Tuple, cast import pytest import spacy import srsly from confection import Config from spacy.language import Language from spacy.tokens import Span from spacy.training import Example from spacy.util import make_tempdir from spacy_llm.co...
offsets
assert
variable
spacy_llm/tests/tasks/test_ner.py
test_ensure_offsets_correspond_to_substrings
326
null
explosion/spacy-llm
from pathlib import Path import pytest import spacy import srsly from confection import Config from spacy.tokens import Span from spacy.training import Example from spacy.util import make_tempdir from spacy_llm.pipeline import LLMWrapper from spacy_llm.registry import fewshot_reader, lowercase_normalizer, strip_norma...
labels
assert
variable
spacy_llm/tests/tasks/legacy/test_spancat.py
test_spancat_serde
599
null
explosion/spacy-llm
import json import re from pathlib import Path import pytest import spacy import srsly from confection import Config from spacy.tokens import Span from spacy.training import Example from spacy.util import make_tempdir from spacy_llm.pipeline import LLMWrapper from spacy_llm.registry import fewshot_reader, file_reader...
1
assert
numeric_literal
spacy_llm/tests/tasks/legacy/test_ner.py
test_ner_to_disk
825
null
explosion/spacy-llm
import csv import functools from pathlib import Path import numpy import pytest import spacy import srsly from confection import Config from spacy import Vocab from spacy.kb import InMemoryLookupKB from spacy.pipeline import EntityLinker from spacy.tokens import Doc, Span from spacy.training import Example from spacy....
EntityLinker.NIL
assert
complex_expr
spacy_llm/tests/tasks/test_entity_linker.py
test_entity_linker_predict_no_candidates
348
null
explosion/spacy-llm
import json from pathlib import Path import pytest from confection import Config from pytest import FixtureRequest from spacy.tokens import Doc, Span from spacy.training import Example from spacy.util import get_lang_class from spacy_llm.pipeline import LLMWrapper from spacy_llm.tasks.rel import DEFAULT_REL_TEMPLATE,...
set(task.labels)
assert
func_call
spacy_llm/tests/tasks/test_rel.py
test_rel_config
132
null
explosion/spacy-llm
from pathlib import Path import pytest import spacy from confection import Config from spacy.util import make_tempdir from spacy_llm.registry import fewshot_reader, file_reader from ...tasks import make_sentiment_task, make_translation_task from ..compat import has_openai_key EXAMPLES_DIR = Path(__file__).parent / ...
""" Translate the text after "Text:" to Spanish. Respond after "Translation:" with nothing but the translated text. Below are some examples (only use these as a guide): Text: Top of the morning to you! Translation: ¡Muy buenos días! Text: The weather is great today. Translation: El clima está fantástico hoy. Text: Do y...
assert
string_literal
spacy_llm/tests/tasks/test_translation.py
test_jinja_template_rendering_with_examples
269
null