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
Kludex/mangum
import urllib.parse import pytest from mangum import Mangum from mangum.handlers.api_gateway import HTTPGateway def get_mock_aws_http_gateway_event_v1(method, path, query_parameters, body, body_base64_encoded): query_string = urllib.parse.urlencode(query_parameters if query_parameters else {}) return { ...
{ "statusCode": 200, "isBase64Encoded": True, "headers": {"content-type": content_type.decode()}, "multiValueHeaders": {}, "body": b64_res_body, }
assert
collection
tests/handlers/test_http_gateway.py
test_aws_http_gateway_response_v1_extra_mime_types
596
null
Kludex/mangum
import urllib.parse import pytest from mangum import Mangum from mangum.handlers.api_gateway import HTTPGateway def get_mock_aws_http_gateway_event_v1(method, path, query_parameters, body, body_base64_encoded): query_string = urllib.parse.urlencode(query_parameters if query_parameters else {}) return { ...
{ "statusCode": 200, "isBase64Encoded": True, "headers": {"content-type": content_type.decode()}, "body": b64_res_body, }
assert
collection
tests/handlers/test_http_gateway.py
test_aws_http_gateway_response_v2_extra_mime_types
643
null
Kludex/mangum
from __future__ import annotations import base64 import gzip import json import logging from typing import cast import brotli import pytest from brotli_asgi import BrotliMiddleware from starlette.applications import Starlette from starlette.middleware.gzip import GZipMiddleware from starlette.requests import Request ...
{ "statusCode": 200, "isBase64Encoded": False, "headers": { "content-type": "text/plain; charset=utf-8", "multivalue": "foo,bar", }, "cookies": ["cookie1=cookie1; Secure", "cookie2=cookie2; Secure"], "body": "Hello, world!", }
assert
collection
tests/test_http.py
test_set_cookies_v2
354
null
Kludex/mangum
import pytest from mangum import Mangum from mangum.adapter import DEFAULT_TEXT_MIME_TYPES from mangum.exceptions import ConfigurationError from mangum.types import Receive, Scope, Send async def app(scope: Scope, receive: Receive, send: Send): ... def test_default_settings(): handler = Mangum(app) assert ha...
sorted(DEFAULT_TEXT_MIME_TYPES)
assert
func_call
tests/test_adapter.py
test_default_settings
16
null
Kludex/mangum
import logging import pytest from quart import Quart from starlette.applications import Starlette from starlette.responses import PlainTextResponse from typing_extensions import Literal from mangum import Mangum from mangum.exceptions import LifespanFailure from mangum.types import Receive, Scope, Send @pytest.mark....
{ "statusCode": 200, "isBase64Encoded": False, "headers": {"content-length": "12", "content-type": "text/html; charset=utf-8"}, "multiValueHeaders": {}, "body": "hello world!", }
assert
collection
tests/test_lifespan.py
test_quart_lifespan
334
null
Kludex/mangum
import pytest from mangum import Mangum from mangum.adapter import DEFAULT_TEXT_MIME_TYPES from mangum.exceptions import ConfigurationError from mangum.types import Receive, Scope, Send async def app(scope: Scope, receive: Receive, send: Send): ... def test_default_settings(): handler = Mangum(app) assert ha...
[]
assert
collection
tests/test_adapter.py
test_default_settings
17
null
Kludex/mangum
import urllib.parse import pytest from mangum import Mangum from mangum.handlers.api_gateway import APIGateway def get_mock_aws_api_gateway_event(method, path, multi_value_query_parameters, body, body_base64_encoded): return { "path": path, "body": body, "isBase64Encoded": body_base64_enc...
"http"
assert
string_literal
tests/handlers/test_api_gateway.py
app
261
null
Kludex/mangum
from __future__ import annotations import pytest from mangum import Mangum from mangum.handlers.alb import ALB def get_mock_aws_alb_event( method, path, query_parameters: dict[str, list[str]] | None, headers: dict[str, list[str]] | None, body, body_base64_encoded, multi_value_headers: boo...
{ "statusCode": 200, "isBase64Encoded": res_base64_encoded, "headers": {"content-type": content_type.decode()}, "body": res_body, }
assert
collection
tests/handlers/test_alb.py
test_aws_alb_response
318
null
Kludex/mangum
import urllib.parse import pytest from mangum import Mangum from mangum.handlers.api_gateway import HTTPGateway def get_mock_aws_http_gateway_event_v1(method, path, query_parameters, body, body_base64_encoded): query_string = urllib.parse.urlencode(query_parameters if query_parameters else {}) return { ...
handler.config["text_mime_types"]
assert
complex_expr
tests/handlers/test_http_gateway.py
test_aws_http_gateway_response_v1_extra_mime_types
595
null
Kludex/mangum
import urllib.parse import pytest from mangum import Mangum from mangum.handlers.api_gateway import HTTPGateway def get_mock_aws_http_gateway_event_v1(method, path, query_parameters, body, body_base64_encoded): query_string = urllib.parse.urlencode(query_parameters if query_parameters else {}) return { ...
{ "statusCode": 200, "isBase64Encoded": res_base64_encoded, "headers": res_headers, "multiValueHeaders": {}, "body": res_body, }
assert
collection
tests/handlers/test_http_gateway.py
test_aws_http_gateway_response_v1
500
null
Kludex/mangum
import urllib.parse import pytest from mangum import Mangum from mangum.handlers.api_gateway import HTTPGateway def get_mock_aws_http_gateway_event_v1(method, path, query_parameters, body, body_base64_encoded): query_string = urllib.parse.urlencode(query_parameters if query_parameters else {}) return { ...
b""
assert
string_literal
tests/handlers/test_http_gateway.py
test_aws_http_gateway_scope_v1_no_headers
230
null
Kludex/mangum
import urllib.parse import pytest from mangum import Mangum from mangum.handlers.api_gateway import APIGateway def get_mock_aws_api_gateway_event(method, path, multi_value_query_parameters, body, body_base64_encoded): return { "path": path, "body": body, "isBase64Encoded": body_base64_enc...
{ "body": "Hello world!", "headers": {"content-type": "text/plain"}, "multiValueHeaders": {}, "isBase64Encoded": False, "statusCode": 200, }
assert
collection
tests/handlers/test_api_gateway.py
test_aws_api_gateway_base_path
275
null
Kludex/mangum
import pytest from mangum import Mangum from mangum.adapter import DEFAULT_TEXT_MIME_TYPES from mangum.exceptions import ConfigurationError from mangum.types import Receive, Scope, Send async def app(scope: Scope, receive: Receive, send: Send): ... def test_default_settings(): handler = Mangum(app) assert ha...
"/"
assert
string_literal
tests/test_adapter.py
test_default_settings
15
null
Kludex/mangum
import urllib.parse import pytest from mangum import Mangum from mangum.handlers.lambda_at_edge import LambdaAtEdge def mock_lambda_at_edge_event(method, path, multi_value_query_parameters, body, body_base64_encoded): headers_raw = { "accept-encoding": "gzip,deflate", "x-forwarded-port": "443", ...
{ "status": 200, "isBase64Encoded": True, "headers": {"content-type": [{"key": "content-type", "value": content_type.decode()}]}, "body": b64_res_body, }
assert
collection
tests/handlers/test_lambda_at_edge.py
test_aws_lambda_at_edge_response_extra_mime_types
307
null
Kludex/mangum
import urllib.parse import pytest from mangum import Mangum from mangum.handlers.api_gateway import HTTPGateway def get_mock_aws_http_gateway_event_v1(method, path, query_parameters, body, body_base64_encoded): query_string = urllib.parse.urlencode(query_parameters if query_parameters else {}) return { ...
b"hello=world"
assert
string_literal
tests/handlers/test_http_gateway.py
test_aws_http_gateway_scope_v1_only_non_multi_headers
218
null
Kludex/mangum
import urllib.parse import pytest from mangum import Mangum from mangum.handlers.api_gateway import HTTPGateway def get_mock_aws_http_gateway_event_v1(method, path, query_parameters, body, body_base64_encoded): query_string = urllib.parse.urlencode(query_parameters if query_parameters else {}) return { ...
{ "asgi": {"version": "3.0", "spec_version": "2.0"}, "aws.context": {}, "aws.event": example_event, "client": ("IP", 0), "headers": [ [b"header1", b"value1"], [b"header2", b"value1,value2"], [b"cookie", b"cookie1; cookie2"], ], "http_version": "1.1", "method": "POST", "path": "/my/path", "query_string": b"parameter1=va...
assert
collection
tests/handlers/test_http_gateway.py
test_aws_http_gateway_scope_basic_v2
290
null
Kludex/mangum
from __future__ import annotations import base64 import gzip import json import logging from typing import cast import brotli import pytest from brotli_asgi import BrotliMiddleware from starlette.applications import Starlette from starlette.middleware.gzip import GZipMiddleware from starlette.requests import Request ...
expected
assert
variable
tests/test_http.py
test_http_response_headers
557
null
Kludex/mangum
import urllib.parse import pytest from mangum import Mangum from mangum.handlers.api_gateway import APIGateway def get_mock_aws_api_gateway_event(method, path, multi_value_query_parameters, body, body_base64_encoded): return { "path": path, "body": body, "isBase64Encoded": body_base64_enc...
urllib.parse.unquote(event["path"])
assert
func_call
tests/handlers/test_api_gateway.py
app
262
null
Kludex/mangum
import logging import pytest from quart import Quart from starlette.applications import Starlette from starlette.responses import PlainTextResponse from typing_extensions import Literal from mangum import Mangum from mangum.exceptions import LifespanFailure from mangum.types import Receive, Scope, Send @pytest.mark....
caplog.text
assert
complex_expr
tests/test_lifespan.py
test_lifespan_error
149
null
Kludex/mangum
from __future__ import annotations import base64 import gzip import json import logging from typing import cast import brotli import pytest from brotli_asgi import BrotliMiddleware from starlette.applications import Starlette from starlette.middleware.gzip import GZipMiddleware from starlette.requests import Request ...
{ "content-encoding": "gzip", "content-type": "application/json", "content-length": "35", "vary": "Accept-Encoding", }
assert
collection
tests/test_http.py
test_http_binary_gzip_response
240
null
Kludex/mangum
import urllib.parse import pytest from mangum import Mangum from mangum.handlers.lambda_at_edge import LambdaAtEdge def mock_lambda_at_edge_event(method, path, multi_value_query_parameters, body, body_base64_encoded): headers_raw = { "accept-encoding": "gzip,deflate", "x-forwarded-port": "443", ...
b""
assert
string_literal
tests/handlers/test_lambda_at_edge.py
test_aws_api_gateway_scope_real
243
null
Kludex/mangum
from __future__ import annotations import base64 import gzip import json import logging from typing import cast import brotli import pytest from brotli_asgi import BrotliMiddleware from starlette.applications import Starlette from starlette.middleware.gzip import GZipMiddleware from starlette.requests import Request ...
"http"
assert
string_literal
tests/test_http.py
app
190
null
Kludex/mangum
from __future__ import annotations import base64 import gzip import json import logging from typing import cast import brotli import pytest from brotli_asgi import BrotliMiddleware from starlette.applications import Starlette from starlette.middleware.gzip import GZipMiddleware from starlette.requests import Request ...
{ "body": "Internal Server Error", "headers": {"content-type": "text/plain; charset=utf-8"}, "isBase64Encoded": False, "multiValueHeaders": {}, "statusCode": 500, }
assert
collection
tests/test_http.py
test_http_exception_mid_response
153
null
Kludex/mangum
from __future__ import annotations import base64 import gzip import json import logging from typing import cast import brotli import pytest from brotli_asgi import BrotliMiddleware from starlette.applications import Starlette from starlette.middleware.gzip import GZipMiddleware from starlette.requests import Request ...
{ "statusCode": 200, "isBase64Encoded": False, "headers": {"content-type": "text/plain; charset=utf-8"}, "multiValueHeaders": {"set-cookie": ["cookie1=cookie1; Secure", "cookie2=cookie2; Secure"]}, "body": "Hello, world!", }
assert
collection
tests/test_http.py
test_http_response
135
null
Kludex/mangum
from __future__ import annotations import base64 import gzip import json import logging from typing import cast import brotli import pytest from brotli_asgi import BrotliMiddleware from starlette.applications import Starlette from starlette.middleware.gzip import GZipMiddleware from starlette.requests import Request ...
{ "body": "Error!", "headers": {"content-length": "6", "content-type": "text/plain; charset=utf-8"}, "multiValueHeaders": {}, "isBase64Encoded": False, "statusCode": 500, }
assert
collection
tests/test_http.py
test_http_exception_handler
178
null
Kludex/mangum
from __future__ import annotations from typing import Any from mangum.types import Headers, LambdaConfig, LambdaContext, LambdaEvent, Scope def test_custom_handler(): event = {"my-custom-key": 1} handler = CustomHandler(event, {}, {"api_gateway_base_path": "/"}) assert isinstance(handler.body, bytes) ...
{ "asgi": {"version": "3.0", "spec_version": "2.0"}, "aws.context": {}, "aws.event": event, "client": ("127.0.0.1", 0), "headers": [], "http_version": "1.1", "method": "GET", "path": "/", "query_string": b"", "raw_path": None, "root_path": "", "scheme": "https", "server": ("mangum", 8080), "type": "http", }
assert
collection
tests/handlers/test_custom.py
test_custom_handler
50
null
Kludex/mangum
import urllib.parse import pytest from mangum import Mangum from mangum.handlers.lambda_at_edge import LambdaAtEdge def mock_lambda_at_edge_event(method, path, multi_value_query_parameters, body, body_base64_encoded): headers_raw = { "accept-encoding": "gzip,deflate", "x-forwarded-port": "443", ...
{ "status": 200, "isBase64Encoded": res_base64_encoded, "headers": {"content-type": [{"key": "content-type", "value": content_type.decode()}]}, "body": res_body, }
assert
collection
tests/handlers/test_lambda_at_edge.py
test_aws_lambda_at_edge_response
277
null
Kludex/mangum
import urllib.parse import pytest from mangum import Mangum from mangum.handlers.api_gateway import APIGateway def get_mock_aws_api_gateway_event(method, path, multi_value_query_parameters, body, body_base64_encoded): return { "path": path, "body": body, "isBase64Encoded": body_base64_enc...
b""
assert
string_literal
tests/handlers/test_api_gateway.py
test_aws_api_gateway_scope_real
240
null
Kludex/mangum
import urllib.parse import pytest from mangum import Mangum from mangum.handlers.api_gateway import HTTPGateway def get_mock_aws_http_gateway_event_v1(method, path, query_parameters, body, body_base64_encoded): query_string = urllib.parse.urlencode(query_parameters if query_parameters else {}) return { ...
scope_body
assert
variable
tests/handlers/test_http_gateway.py
test_aws_http_gateway_scope_real_v1
371
null
cohere-ai/cohere-python
import os import typing import unittest import cohere from cohere import ToolMessage, UserMessage, AssistantMessage co = cohere.ClientV2(timeout=10000) package_dir = os.path.dirname(os.path.abspath(__file__)) embed_job = os.path.join(package_dir, "embed_job.jsonl") class TestClientV2(unittest.TestCase): def te...
"message-start" in events)
self.assertTrue
string_literal
tests/test_client_v2.py
test_chat_stream
TestClientV2
34
null
cohere-ai/cohere-python
import os import unittest import typing import cohere aws_access_key = os.getenv("AWS_ACCESS_KEY") aws_secret_key = os.getenv("AWS_SECRET_KEY") aws_session_token = os.getenv("AWS_SESSION_TOKEN") aws_region = os.getenv("AWS_REGION") endpoint_type = os.getenv("ENDPOINT_TYPE") def _setup_boto3_env(): """Bridge cust...
response.text)
self.assertIsNotNone
complex_expr
tests/test_bedrock_client.py
test_chat
TestClient
90
null
cohere-ai/cohere-python
import os import unittest import typing import cohere aws_access_key = os.getenv("AWS_ACCESS_KEY") aws_secret_key = os.getenv("AWS_SECRET_KEY") aws_session_token = os.getenv("AWS_SESSION_TOKEN") aws_region = os.getenv("AWS_REGION") endpoint_type = os.getenv("ENDPOINT_TYPE") def _setup_boto3_env(): """Bridge cust...
0)
self.assertGreater
numeric_literal
tests/test_bedrock_client.py
test_embed
TestCohereAwsBedrockClient
189
null
cohere-ai/cohere-python
import os import unittest import typing import cohere aws_access_key = os.getenv("AWS_ACCESS_KEY") aws_secret_key = os.getenv("AWS_SECRET_KEY") aws_session_token = os.getenv("AWS_SESSION_TOKEN") aws_region = os.getenv("AWS_REGION") endpoint_type = os.getenv("ENDPOINT_TYPE") def _setup_boto3_env(): """Bridge cust...
3)
self.assertEqual
numeric_literal
tests/test_bedrock_client.py
test_rerank
TestClient
56
null
cohere-ai/cohere-python
import os import unittest import cohere from cohere import ChatConnector, ClassifyExample, CreateConnectorServiceAuth, Tool, \ ToolParameterDefinitionsValue, ToolResult, UserMessage, ChatbotMessage package_dir = os.path.dirname(os.path.abspath(__file__)) embed_job = os.path.join(package_dir, 'embed_job.jsonl') c...
"complete")
self.assertEqual
string_literal
tests/test_async_client.py
test_embed_job_crud
TestClient
158
null
cohere-ai/cohere-python
import json import os import unittest import cohere from cohere import ChatConnector, ClassifyExample, CreateConnectorServiceAuth, Tool, \ ToolParameterDefinitionsValue, ToolResult, ChatbotMessage, UserMessage, JsonObjectResponseFormat co = cohere.Client(timeout=10000) package_dir = os.path.dirname(os.path.abspa...
100)
self.assertEqual
numeric_literal
tests/test_client.py
test_embed_batch_types
TestClient
142
null
cohere-ai/cohere-python
import os import typing import unittest import cohere from cohere import ToolMessage, UserMessage, AssistantMessage co = cohere.ClientV2(timeout=10000) package_dir = os.path.dirname(os.path.abspath(__file__)) embed_job = os.path.join(package_dir, "embed_job.jsonl") class TestClientV2(unittest.TestCase): def te...
"content-start" in events)
self.assertTrue
string_literal
tests/test_client_v2.py
test_chat_stream
TestClientV2
35
null
cohere-ai/cohere-python
import os import typing import unittest import cohere from cohere import ToolMessage, UserMessage, AssistantMessage co = cohere.ClientV2(timeout=10000) package_dir = os.path.dirname(os.path.abspath(__file__)) embed_job = os.path.join(package_dir, "embed_job.jsonl") class TestClientV2(unittest.TestCase): def te...
callable(getattr(co, "generate_stream")))
self.assertTrue
func_call
tests/test_client_v2.py
test_legacy_methods_available
TestClientV2
44
null
cohere-ai/cohere-python
import os import typing import unittest import cohere from cohere import ToolMessage, UserMessage, AssistantMessage co = cohere.ClientV2(timeout=10000) package_dir = os.path.dirname(os.path.abspath(__file__)) embed_job = os.path.join(package_dir, "embed_job.jsonl") class TestClientV2(unittest.TestCase): def te...
callable(getattr(co, "generate")))
self.assertTrue
func_call
tests/test_client_v2.py
test_legacy_methods_available
TestClientV2
42
null
cohere-ai/cohere-python
import os import unittest import typing import cohere aws_access_key = os.getenv("AWS_ACCESS_KEY") aws_secret_key = os.getenv("AWS_SECRET_KEY") aws_session_token = os.getenv("AWS_SESSION_TOKEN") aws_region = os.getenv("AWS_REGION") endpoint_type = os.getenv("ENDPOINT_TYPE") def _setup_boto3_env(): """Bridge cust...
event.text)
self.assertIsNotNone
complex_expr
tests/test_bedrock_client.py
test_chat_stream
TestClient
116
null
cohere-ai/cohere-python
import os import unittest import typing import cohere aws_access_key = os.getenv("AWS_ACCESS_KEY") aws_secret_key = os.getenv("AWS_SECRET_KEY") aws_session_token = os.getenv("AWS_SESSION_TOKEN") aws_region = os.getenv("AWS_REGION") endpoint_type = os.getenv("ENDPOINT_TYPE") def _setup_boto3_env(): """Bridge cust...
response.embeddings)
self.assertIsNotNone
complex_expr
tests/test_bedrock_client.py
test_embed
TestCohereAwsBedrockClient
188
null
cohere-ai/cohere-python
import os import unittest import cohere from cohere import ChatConnector, ClassifyExample, CreateConnectorServiceAuth, Tool, \ ToolParameterDefinitionsValue, ToolResult, UserMessage, ChatbotMessage package_dir = os.path.dirname(os.path.abspath(__file__)) embed_job = os.path.join(package_dir, 'embed_job.jsonl') c...
{ "day": "2023-09-29"})
self.assertEqual
collection
tests/test_async_client.py
test_tool_use
TestClient
268
null
cohere-ai/cohere-python
import json import os import unittest import cohere from cohere import ChatConnector, ClassifyExample, CreateConnectorServiceAuth, Tool, \ ToolParameterDefinitionsValue, ToolResult, ChatbotMessage, UserMessage, JsonObjectResponseFormat co = cohere.Client(timeout=10000) package_dir = os.path.dirname(os.path.abspa...
"complete")
self.assertEqual
string_literal
tests/test_client.py
test_embed_job_crud
TestClient
195
null
cohere-ai/cohere-python
import json import os import unittest import cohere from cohere import ChatConnector, ClassifyExample, CreateConnectorServiceAuth, Tool, \ ToolParameterDefinitionsValue, ToolResult, ChatbotMessage, UserMessage, JsonObjectResponseFormat co = cohere.Client(timeout=10000) package_dir = os.path.dirname(os.path.abspa...
int)
self.assertEqual
variable
tests/test_client.py
test_embed
TestClient
97
null
cohere-ai/cohere-python
import os import typing import unittest import cohere from cohere import ToolMessage, UserMessage, AssistantMessage co = cohere.ClientV2(timeout=10000) package_dir = os.path.dirname(os.path.abspath(__file__)) embed_job = os.path.join(package_dir, "embed_job.jsonl") class TestClientV2(unittest.TestCase): def te...
hasattr(co, "generate_stream"))
self.assertTrue
func_call
tests/test_client_v2.py
test_legacy_methods_available
TestClientV2
43
null
cohere-ai/cohere-python
import os import unittest import cohere from cohere import ChatConnector, ClassifyExample, CreateConnectorServiceAuth, Tool, \ ToolParameterDefinitionsValue, ToolResult, UserMessage, ChatbotMessage package_dir = os.path.dirname(os.path.abspath(__file__)) embed_job = os.path.join(package_dir, 'embed_job.jsonl') c...
"validated")
self.assertEqual
string_literal
tests/test_async_client.py
test_embed_job_crud
TestClient
141
null
cohere-ai/cohere-python
import os import unittest import cohere from cohere import ChatConnector, ClassifyExample, CreateConnectorServiceAuth, Tool, \ ToolParameterDefinitionsValue, ToolResult, UserMessage, ChatbotMessage package_dir = os.path.dirname(os.path.abspath(__file__)) embed_job = os.path.join(package_dir, 'embed_job.jsonl') c...
os.path.exists("dataset.jsonl"))
self.assertTrue
func_call
tests/test_async_client.py
test_save_load
TestClient
213
null
cohere-ai/cohere-python
import os import typing import unittest import cohere from cohere import ToolMessage, UserMessage, AssistantMessage co = cohere.ClientV2(timeout=10000) package_dir = os.path.dirname(os.path.abspath(__file__)) embed_job = os.path.join(package_dir, "embed_job.jsonl") class TestClientV2(unittest.TestCase): def te...
hasattr(co, "generate"))
self.assertTrue
func_call
tests/test_client_v2.py
test_legacy_methods_available
TestClientV2
41
null
cohere-ai/cohere-python
import os import unittest import typing import cohere aws_access_key = os.getenv("AWS_ACCESS_KEY") aws_secret_key = os.getenv("AWS_SECRET_KEY") aws_session_token = os.getenv("AWS_SESSION_TOKEN") aws_region = os.getenv("AWS_REGION") endpoint_type = os.getenv("ENDPOINT_TYPE") def _setup_boto3_env(): """Bridge cust...
Mode.BEDROCK)
self.assertEqual
complex_expr
tests/test_bedrock_client.py
test_client_is_bedrock_mode
TestCohereAwsBedrockClient
179
null
cohere-ai/cohere-python
import os import typing import unittest import cohere from cohere import ToolMessage, UserMessage, AssistantMessage co = cohere.ClientV2(timeout=10000) package_dir = os.path.dirname(os.path.abspath(__file__)) embed_job = os.path.join(package_dir, "embed_job.jsonl") class TestClientV2(unittest.TestCase): def te...
"message-end" in events)
self.assertTrue
string_literal
tests/test_client_v2.py
test_chat_stream
TestClientV2
38
null
cohere-ai/cohere-python
import os import unittest import cohere from cohere import ChatConnector, ClassifyExample, CreateConnectorServiceAuth, Tool, \ ToolParameterDefinitionsValue, ToolResult, UserMessage, ChatbotMessage package_dir = os.path.dirname(os.path.abspath(__file__)) embed_job = os.path.join(package_dir, 'embed_job.jsonl') c...
"sales_database")
self.assertEqual
string_literal
tests/test_async_client.py
test_tool_use
TestClient
266
null
cohere-ai/cohere-python
import json import os import unittest import cohere from cohere import ChatConnector, ClassifyExample, CreateConnectorServiceAuth, Tool, \ ToolParameterDefinitionsValue, ToolResult, ChatbotMessage, UserMessage, JsonObjectResponseFormat co = cohere.Client(timeout=10000) package_dir = os.path.dirname(os.path.abspa...
ValueError)
self.assertRaises
variable
tests/test_client.py
test_stream_equals_true
TestClient
61
null
cohere-ai/cohere-python
import os import unittest import cohere from cohere import ChatConnector, ClassifyExample, CreateConnectorServiceAuth, Tool, \ ToolParameterDefinitionsValue, ToolResult, UserMessage, ChatbotMessage package_dir = os.path.dirname(os.path.abspath(__file__)) embed_job = os.path.join(package_dir, 'embed_job.jsonl') c...
client)
self.assertIsNotNone
variable
tests/test_async_client.py
test_context_manager
TestClient
24
null
cohere-ai/cohere-python
import json import os import unittest import cohere from cohere import ChatConnector, ClassifyExample, CreateConnectorServiceAuth, Tool, \ ToolParameterDefinitionsValue, ToolResult, ChatbotMessage, UserMessage, JsonObjectResponseFormat co = cohere.Client(timeout=10000) package_dir = os.path.dirname(os.path.abspa...
client)
self.assertIsNotNone
variable
tests/test_client.py
test_context_manager
TestClient
23
null
cohere-ai/cohere-python
import unittest from cohere import EmbeddingsByTypeEmbedResponse, EmbedByTypeResponseEmbeddings, ApiMeta, ApiMetaBilledUnits, \ ApiMetaApiVersion, EmbeddingsFloatsEmbedResponse from cohere.utils import merge_embed_responses ebt_1 = EmbeddingsByTypeEmbedResponse( response_type="embeddings_by_type", id="1",...
{"test_warning_1", "test_warning_2"})
self.assertEqual
collection
tests/test_embed_utils.py
test_merge_embeddings_by_type
TestClient
141
null
cohere-ai/cohere-python
import unittest from contextlib import redirect_stderr import logging from cohere import EmbedByTypeResponseEmbeddings LOGGER = logging.getLogger(__name__) class TestClient(unittest.TestCase): def test_float_alias(self) -> None: embeds = EmbedByTypeResponseEmbeddings(float_=[[1.0]]) self.assert...
[[1.0]])
self.assertEqual
collection
tests/test_overrides.py
test_float_alias
TestClient
14
null
cohere-ai/cohere-python
import os import unittest import cohere from cohere import ChatConnector, ClassifyExample, CreateConnectorServiceAuth, Tool, \ ToolParameterDefinitionsValue, ToolResult, UserMessage, ChatbotMessage package_dir = os.path.dirname(os.path.abspath(__file__)) embed_job = os.path.join(package_dir, 'embed_job.jsonl') c...
100)
self.assertEqual
numeric_literal
tests/test_async_client.py
test_embed_batch_types
TestClient
105
null
cohere-ai/cohere-python
import os import unittest import cohere from cohere import ChatConnector, ClassifyExample, CreateConnectorServiceAuth, Tool, \ ToolParameterDefinitionsValue, ToolResult, UserMessage, ChatbotMessage package_dir = os.path.dirname(os.path.abspath(__file__)) embed_job = os.path.join(package_dir, 'embed_job.jsonl') c...
open("dataset.jsonl", 'rb').read())
self.assertEqual
func_call
tests/test_async_client.py
test_save_load
TestClient
214
null
cohere-ai/cohere-python
import os import unittest import typing import cohere aws_access_key = os.getenv("AWS_ACCESS_KEY") aws_secret_key = os.getenv("AWS_SECRET_KEY") aws_session_token = os.getenv("AWS_SESSION_TOKEN") aws_region = os.getenv("AWS_REGION") endpoint_type = os.getenv("ENDPOINT_TYPE") def _setup_boto3_env(): """Bridge cust...
event.response)
self.assertIsNotNone
complex_expr
tests/test_bedrock_client.py
test_chat_stream
TestClient
119
null
cohere-ai/cohere-python
import os import unittest import typing import cohere aws_access_key = os.getenv("AWS_ACCESS_KEY") aws_secret_key = os.getenv("AWS_SECRET_KEY") aws_session_token = os.getenv("AWS_SESSION_TOKEN") aws_region = os.getenv("AWS_REGION") endpoint_type = os.getenv("ENDPOINT_TYPE") def _setup_boto3_env(): """Bridge cust...
event.response.text)
self.assertIsNotNone
complex_expr
tests/test_bedrock_client.py
test_chat_stream
TestClient
120
null
cohere-ai/cohere-python
import inspect import json import os import unittest from unittest.mock import MagicMock, patch import httpx from cohere.manually_maintained.cohere_aws.mode import Mode class TestModeConditionalInit(unittest.TestCase): def test_default_mode_is_sagemaker(self) -> None: from cohere.manually_maintained.coh...
Mode.SAGEMAKER)
self.assertEqual
complex_expr
tests/test_aws_client_unit.py
test_default_mode_is_sagemaker
TestModeConditionalInit
129
null
cohere-ai/cohere-python
import os import typing import unittest import cohere from cohere import ToolMessage, UserMessage, AssistantMessage co = cohere.ClientV2(timeout=10000) package_dir = os.path.dirname(os.path.abspath(__file__)) embed_job = os.path.join(package_dir, "embed_job.jsonl") class TestClientV2(unittest.TestCase): def te...
"content-end" in events)
self.assertTrue
string_literal
tests/test_client_v2.py
test_chat_stream
TestClientV2
37
null
cohere-ai/cohere-python
import os import unittest import cohere from cohere import ChatConnector, ClassifyExample, CreateConnectorServiceAuth, Tool, \ ToolParameterDefinitionsValue, ToolResult, UserMessage, ChatbotMessage package_dir = os.path.dirname(os.path.abspath(__file__)) embed_job = os.path.join(package_dir, 'embed_job.jsonl') c...
"stream-start" in events)
self.assertTrue
string_literal
tests/test_async_client.py
test_chat_stream
TestClient
60
null
cohere-ai/cohere-python
import inspect import json import os import unittest from unittest.mock import MagicMock, patch import httpx from cohere.manually_maintained.cohere_aws.mode import Mode class TestSigV4HostHeader(unittest.TestCase): def test_sigv4_signs_with_correct_host(self) -> None: captured_aws_request_kwargs: dict =...
"api.cohere.com")
self.assertEqual
string_literal
tests/test_aws_client_unit.py
test_sigv4_signs_with_correct_host
TestSigV4HostHeader
64
null
cohere-ai/cohere-python
import os import unittest import cohere from cohere import ChatConnector, ClassifyExample, CreateConnectorServiceAuth, Tool, \ ToolParameterDefinitionsValue, ToolResult, UserMessage, ChatbotMessage package_dir = os.path.dirname(os.path.abspath(__file__)) embed_job = os.path.join(package_dir, 'embed_job.jsonl') c...
[ { "average_sale_value": "404.17", "date": "2023-09-29", "id": "sales_database:0:0", "number_of_sales": "120", "total_revenue": "48500", } ])
self.assertEqual
collection
tests/test_async_client.py
test_tool_use
TestClient
300
null
cohere-ai/cohere-python
import os import typing import unittest import cohere from cohere import ToolMessage, UserMessage, AssistantMessage co = cohere.ClientV2(timeout=10000) package_dir = os.path.dirname(os.path.abspath(__file__)) embed_job = os.path.join(package_dir, "embed_job.jsonl") class TestClientV2(unittest.TestCase): def te...
"content-delta" in events)
self.assertTrue
string_literal
tests/test_client_v2.py
test_chat_stream
TestClientV2
36
null
cohere-ai/cohere-python
import os import unittest import cohere from cohere import ChatConnector, ClassifyExample, CreateConnectorServiceAuth, Tool, \ ToolParameterDefinitionsValue, ToolResult, UserMessage, ChatbotMessage package_dir = os.path.dirname(os.path.abspath(__file__)) embed_job = os.path.join(package_dir, 'embed_job.jsonl') c...
"stream-end" in events)
self.assertTrue
string_literal
tests/test_async_client.py
test_chat_stream
TestClient
61
null
cohere-ai/cohere-python
import inspect import json import os import unittest from unittest.mock import MagicMock, patch import httpx from cohere.manually_maintained.cohere_aws.mode import Mode class TestEmbedV4Params(unittest.TestCase): def _make_bedrock_client(): # type: ignore mock_boto3 = MagicMock() mock_botocore ...
dict)
self.assertIsInstance
variable
tests/test_aws_client_unit.py
test_embed_with_embedding_types_returns_dict
TestEmbedV4Params
251
null
cohere-ai/cohere-python
import inspect import json import os import unittest from unittest.mock import MagicMock, patch import httpx from cohere.manually_maintained.cohere_aws.mode import Mode class TestEmbedV4Params(unittest.TestCase): def _make_bedrock_client(): # type: ignore mock_boto3 = MagicMock() mock_botocore ...
captured_body)
self.assertNotIn
variable
tests/test_aws_client_unit.py
test_embed_omits_none_params
TestEmbedV4Params
207
null
cohere-ai/cohere-python
import inspect import json import os import unittest from unittest.mock import MagicMock, patch import httpx from cohere.manually_maintained.cohere_aws.mode import Mode class TestModeConditionalInit(unittest.TestCase): def test_sagemaker_mode_creates_sagemaker_clients(self) -> None: mock_boto3 = MagicMo...
service_names)
self.assertIn
variable
tests/test_aws_client_unit.py
test_sagemaker_mode_creates_sagemaker_clients
TestModeConditionalInit
96
null
cohere-ai/cohere-python
import unittest from cohere import EmbeddingsByTypeEmbedResponse, EmbedByTypeResponseEmbeddings, ApiMeta, ApiMetaBilledUnits, \ ApiMetaApiVersion, EmbeddingsFloatsEmbedResponse from cohere.utils import merge_embed_responses ebt_1 = EmbeddingsByTypeEmbedResponse( response_type="embeddings_by_type", id="1",...
EmbeddingsFloatsEmbedResponse( response_type="embeddings_floats", id="1, 2", texts=["hello", "goodbye", "bye", "seeya"], embeddings=[[0, 1, 2], [3, 4, 5], [7, 8, 9], [10, 11, 12]], meta=ApiMeta( api_version=ApiMetaApiVersion(version="1"), billed_units=ApiMetaBilledUnits( input_tokens=3, output_tokens=3, search_units=3,...
self.assertEqual
func_call
tests/test_embed_utils.py
test_merge_embeddings_floats
TestClient
175
null
cohere-ai/cohere-python
import os import unittest import typing import cohere aws_access_key = os.getenv("AWS_ACCESS_KEY") aws_secret_key = os.getenv("AWS_SECRET_KEY") aws_session_token = os.getenv("AWS_SESSION_TOKEN") aws_region = os.getenv("AWS_REGION") endpoint_type = os.getenv("ENDPOINT_TYPE") def _setup_boto3_env(): """Bridge cust...
event.finish_reason)
self.assertIsNotNone
complex_expr
tests/test_bedrock_client.py
test_chat_stream
TestClient
118
null
fabriziosalmi/certmate
import pytest from unittest.mock import MagicMock, patch from pathlib import Path class TestRoute53PropagationFlag: def setup_method(self): from modules.core.dns_strategies import Route53Strategy, CloudflareStrategy, DNSStrategyFactory self.route53 = Route53Strategy() self.cloudflare = Clo...
True
assert
bool_literal
tests/test_san_domains.py
test_other_providers_do_support_propagation_flag
TestRoute53PropagationFlag
157
null
fabriziosalmi/certmate
import json import pytest from unittest.mock import MagicMock from pathlib import Path from modules.core.deployer import DeployManager from modules.core.shell import MockShellExecutor def shell_executor(): return MockShellExecutor() def settings_manager(): mgr = MagicMock() mgr.load_settings.return_value ...
300
assert
numeric_literal
tests/test_deployer.py
test_timeout_clamped
TestConfig
256
null
fabriziosalmi/certmate
import pytest from unittest.mock import MagicMock, patch from pathlib import Path class TestDnsProviderFallback: def setup_method(self): from modules.core.settings import SettingsManager self.mgr = SettingsManager.__new__(SettingsManager) self.mgr.settings_file = Path('/tmp/fake-settings.j...
'route53'
assert
string_literal
tests/test_san_domains.py
test_returns_configured_default_provider
TestDnsProviderFallback
105
null
fabriziosalmi/certmate
import pytest from unittest.mock import MagicMock, patch from pathlib import Path from modules.core.digest import WeeklyDigest def mock_managers(): """Create mock managers for digest tests.""" settings_mgr = MagicMock() settings_mgr.load_settings.return_value = { 'domains': [ {'domain':...
1
assert
numeric_literal
tests/test_digest.py
test_server_cert_stats
TestBuildDigest
101
null
fabriziosalmi/certmate
import pytest from unittest.mock import MagicMock, patch from pathlib import Path class TestBuildCertbotCommandSanDomains: def setup_method(self): from modules.core.ca_manager import CAManager self.ca_manager = CAManager.__new__(CAManager) self.ca_manager.settings_manager = MagicMock() ...
['example.com']
assert
collection
tests/test_san_domains.py
test_no_san_domains
TestBuildCertbotCommandSanDomains
71
null
fabriziosalmi/certmate
import pytest from unittest.mock import MagicMock, patch from modules.core.auth import AuthManager, ROLE_HIERARCHY def settings_store(): """Shared mutable settings dict.""" return { 'local_auth_enabled': False, 'users': {}, 'api_bearer_token': 'legacy_test_token_abc123', 'api_ke...
err
assert
variable
tests/test_apikeys.py
test_duplicate_name_fails
TestCreateApiKey
57
null
fabriziosalmi/certmate
import pytest from unittest.mock import MagicMock, patch from pathlib import Path from modules.core.digest import WeeklyDigest def mock_managers(): """Create mock managers for digest tests.""" settings_mgr = MagicMock() settings_mgr.load_settings.return_value = { 'domains': [ {'domain':...
2
assert
numeric_literal
tests/test_digest.py
test_client_cert_stats
TestBuildDigest
111
null
fabriziosalmi/certmate
import pytest pytestmark = [pytest.mark.e2e] class TestPageLoading: def test_client_certificates_redirects(self, api): """Client certificates page redirects to unified certificates page.""" r = api.get("/client-certificates", allow_redirects=False) assert r.status_code == 302 ass...
r.headers.get("Location", "")
assert
func_call
tests/test_pages.py
test_client_certificates_redirects
TestPageLoading
30
null
fabriziosalmi/certmate
import json import pytest from unittest.mock import MagicMock from pathlib import Path from modules.core.deployer import DeployManager from modules.core.shell import MockShellExecutor def shell_executor(): return MockShellExecutor() def settings_manager(): mgr = MagicMock() mgr.load_settings.return_value ...
{}
assert
collection
tests/test_deployer.py
test_defaults_when_no_config
TestConfig
209
null
fabriziosalmi/certmate
import pytest from unittest.mock import MagicMock, patch from pathlib import Path from modules.core.digest import WeeklyDigest def mock_managers(): """Create mock managers for digest tests.""" settings_mgr = MagicMock() settings_mgr.load_settings.return_value = { 'domains': [ {'domain':...
html
assert
variable
tests/test_digest.py
test_html_format
TestFormatDigest
141
null
fabriziosalmi/certmate
import pytest pytestmark = [pytest.mark.e2e] class TestWelcomeBanner: def test_index_loads_dashboard_js(self, api): r = api.get("/", allow_redirects=True) assert "dashboard.js" in
r.text
assert
complex_expr
tests/test_pages.py
test_index_loads_dashboard_js
TestWelcomeBanner
38
null
fabriziosalmi/certmate
import pytest pytestmark = [pytest.mark.e2e] class TestSettingsSave: def test_save_and_reload(self, api): email = "reload-test@example.com" api.post_json("/api/web/settings", { "email": email, "dns_provider": "cloudflare", }) r = api.get("/api/web/settings"...
email
assert
variable
tests/test_settings.py
test_save_and_reload
TestSettingsSave
43
null
fabriziosalmi/certmate
import pytest pytestmark = [pytest.mark.e2e] class TestUserManagement: def test_create_and_delete_user(self, api): # Create r = api.post_json("/api/users", { "username": "testuser", "password": "TestPass123!", "role": "user", }) assert r.status_...
data.get("users", {})
assert
func_call
tests/test_auth.py
test_create_and_delete_user
TestUserManagement
80
null
fabriziosalmi/certmate
import pytest pytestmark = [pytest.mark.e2e] class TestStaticFiles: @pytest.mark.parametrize("path", [ "/static/css/tailwind.min.css", "/static/css/fontawesome.min.css", "/static/js/htmx.min.js", "/static/js/alpine.min.js", "/static/js/certmate.js", "/static/webfon...
200
assert
numeric_literal
tests/test_static_csp.py
test_static_asset_returns_200
TestStaticFiles
29
null
fabriziosalmi/certmate
import pytest pytestmark = [pytest.mark.e2e] class TestPageLoading: def test_client_certificates_redirects(self, api): """Client certificates page redirects to unified certificates page.""" r = api.get("/client-certificates", allow_redirects=False) assert r.status_code ==
302
assert
numeric_literal
tests/test_pages.py
test_client_certificates_redirects
TestPageLoading
29
null
fabriziosalmi/certmate
import pytest pytestmark = [pytest.mark.e2e] class TestSettingsLoad: def test_load_initial_settings(self, api): r = api.get("/api/web/settings") assert r.status_code ==
200
assert
numeric_literal
tests/test_settings.py
test_load_initial_settings
TestSettingsLoad
15
null
fabriziosalmi/certmate
import pytest from unittest.mock import MagicMock, patch from modules.core.auth import AuthManager, ROLE_HIERARCHY def settings_store(): """Shared mutable settings dict.""" return { 'local_auth_enabled': False, 'users': {}, 'api_bearer_token': 'legacy_test_token_abc123', 'api_ke...
True
assert
bool_literal
tests/test_apikeys.py
test_creates_key_with_cm_prefix
TestCreateApiKey
34
null
fabriziosalmi/certmate
import pytest pytestmark = [pytest.mark.e2e] class TestSetupModeBypass: def test_health_always_accessible(self, api): r = api.get("/health") assert r.status_code == 200 data = r.json() assert data["status"] ==
"healthy"
assert
string_literal
tests/test_auth.py
test_health_always_accessible
TestSetupModeBypass
32
null
fabriziosalmi/certmate
import pytest pytestmark = [pytest.mark.e2e] class TestSettingsLoad: def test_load_initial_settings(self, api): r = api.get("/api/web/settings") assert r.status_code == 200 data = r.json() assert "dns_provider" in
data
assert
variable
tests/test_settings.py
test_load_initial_settings
TestSettingsLoad
17
null
fabriziosalmi/certmate
import pytest from unittest.mock import MagicMock, patch from pathlib import Path class TestAcmeConnectionSSLHandling: def test_ca_cert_written_to_tempfile_for_verification(self, tmp_path): """When a CA cert is supplied the connection test should pass verify=<path>.""" import tempfile, os ...
fh.read()
assert
func_call
tests/test_san_domains.py
test_ca_cert_written_to_tempfile_for_verification
TestAcmeConnectionSSLHandling
210
null
fabriziosalmi/certmate
import pytest from unittest.mock import MagicMock, patch from pathlib import Path class TestBuildCertbotCommandSanDomains: def setup_method(self): from modules.core.ca_manager import CAManager self.ca_manager = CAManager.__new__(CAManager) self.ca_manager.settings_manager = MagicMock() ...
d_flags
assert
variable
tests/test_san_domains.py
test_san_domains_added_to_command
TestBuildCertbotCommandSanDomains
55
null
fabriziosalmi/certmate
import os import uuid import zipfile import io import pytest pytestmark = [pytest.mark.e2e, pytest.mark.slow] BASE_DOMAIN = os.environ.get("CERTMATE_TEST_DOMAIN", "gpfree.org") TEST_EMAIL = os.environ.get("CERTMATE_TEST_EMAIL", "test@gpfree.org") _run_id = uuid.uuid4().hex[:8] TEST_DOMAIN = f"e2e-{_run_id}.{BASE_DOM...
(200, 400)
assert
collection
tests/test_cert_lifecycle.py
test_06_renew_certificate
TestCertificateRenewal
114
null
fabriziosalmi/certmate
import pytest from unittest.mock import MagicMock, patch from modules.core.auth import AuthManager, ROLE_HIERARCHY def settings_store(): """Shared mutable settings dict.""" return { 'local_auth_enabled': False, 'users': {}, 'api_bearer_token': 'legacy_test_token_abc123', 'api_ke...
None
assert
none_literal
tests/test_apikeys.py
test_legacy_token_returns_admin
TestAuthenticateApiToken
130
null
fabriziosalmi/certmate
import pytest from unittest.mock import MagicMock, patch from pathlib import Path from modules.core.digest import WeeklyDigest def mock_managers(): """Create mock managers for digest tests.""" settings_mgr = MagicMock() settings_mgr.load_settings.return_value = { 'domains': [ {'domain':...
data
assert
variable
tests/test_digest.py
test_has_generated_at
TestBuildDigest
123
null
fabriziosalmi/certmate
import pytest from unittest.mock import MagicMock, patch from modules.core.auth import AuthManager, ROLE_HIERARCHY def settings_store(): """Shared mutable settings dict.""" return { 'local_auth_enabled': False, 'users': {}, 'api_bearer_token': 'legacy_test_token_abc123', 'api_ke...
{}
assert
collection
tests/test_apikeys.py
test_empty_list
TestListApiKeys
103
null
fabriziosalmi/certmate
import pytest from unittest.mock import MagicMock, patch from pathlib import Path class TestDnsProviderFallback: def setup_method(self): from modules.core.settings import SettingsManager self.mgr = SettingsManager.__new__(SettingsManager) self.mgr.settings_file = Path('/tmp/fake-settings.j...
None
assert
none_literal
tests/test_san_domains.py
test_returns_none_when_no_provider_configured
TestDnsProviderFallback
99
null
fabriziosalmi/certmate
import pytest from unittest.mock import MagicMock, patch from pathlib import Path class TestRoute53PropagationFlag: def setup_method(self): from modules.core.dns_strategies import Route53Strategy, CloudflareStrategy, DNSStrategyFactory self.route53 = Route53Strategy() self.cloudflare = Clo...
False
assert
bool_literal
tests/test_san_domains.py
test_route53_does_not_support_propagation_flag
TestRoute53PropagationFlag
153
null
fabriziosalmi/certmate
import pytest pytestmark = [pytest.mark.e2e] class TestCSPHeaders: @pytest.mark.parametrize("path", ["/", "/settings", "/help"]) def test_csp_no_external_cdn(self, api, path): r = api.get(path, allow_redirects=True) assert r.status_code == 200 csp = r.headers.get("Content-Security-Pol...
csp
assert
variable
tests/test_static_csp.py
test_csp_no_external_cdn
TestCSPHeaders
50
null
fabriziosalmi/certmate
import os import re import pytest pytest.importorskip("playwright") from playwright.sync_api import Page, expect pytestmark = [pytest.mark.e2e, pytest.mark.ui] BASE_URL = f"http://localhost:{os.environ.get('CERTMATE_TEST_PORT', '18888')}" def browser_page(docker_container): """Provide a Playwright browser page...
0
assert
numeric_literal
tests/test_ui.py
test_no_console_errors
TestSettingsUI
124
null