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 |
|---|---|---|---|---|---|---|---|---|---|
run-llama/llama_deploy | from unittest import mock
import pytest
from llama_deploy.client import Client
from llama_deploy.client.client import _SyncClient
from llama_deploy.client.models import ApiServer
def test_client_attributes() -> None:
c = Client()
assert type(c.apiserver) is | ApiServer | assert | variable | tests/client/test_client.py | test_client_attributes | 45 | null | |
run-llama/llama_deploy | import io
from typing import Any
from unittest import mock
import httpx
import pytest
from llama_deploy.client.models.apiserver import (
ApiServer,
Deployment,
DeploymentCollection,
SessionCollection,
Task,
TaskCollection,
)
from llama_deploy.types import SessionDefinition, TaskDefinition, Tas... | "session2" | assert | string_literal | tests/client/models/test_apiserver.py | test_session_collection_list | 87 | null | |
run-llama/llama_deploy | from unittest import mock
import httpx
from click.testing import CliRunner
from llama_deploy.cli import llamactl
from llama_deploy.types import TaskDefinition
def test_run_error(runner: CliRunner) -> None:
with mock.patch("llama_deploy.cli.run.Client") as mocked_client:
err_response = mock.MagicMock()
... | 'Error: test error {"error": "test error"}\n' | assert | string_literal | tests/cli/test_run.py | test_run_error | 49 | null | |
run-llama/llama_deploy | import asyncio
import json
import subprocess
import sys
from collections.abc import Generator
from copy import deepcopy
from pathlib import Path
from typing import Any
from unittest import mock
import pytest
from workflows import Context, Workflow
from workflows.handler import WorkflowHandler
from llama_deploy.apiser... | mock_handler | assert | variable | tests/apiserver/test_deployment.py | test_run_workflow_no_wait_without_session_id | 789 | null | |
run-llama/llama_deploy | from unittest import mock
import pytest
from llama_deploy.client import Client
from llama_deploy.client.client import _SyncClient
from llama_deploy.client.models import ApiServer
def test_client_init_settings() -> None:
c = Client(api_server_url="test")
assert c.api_server_url == | "test" | assert | string_literal | tests/client/test_client.py | test_client_init_settings | 20 | null | |
run-llama/llama_deploy | from pathlib import Path
import pytest
from click.testing import CliRunner
from llama_deploy.cli import llamactl
def test_get_profiles(runner: CliRunner) -> None:
result = runner.invoke(llamactl, ["config", "get-profiles"])
assert result.exit_code == | 0 | assert | numeric_literal | tests/cli/test_config.py | test_get_profiles | 11 | null | |
run-llama/llama_deploy | from pathlib import Path
from unittest import mock
import pytest
from llama_deploy.apiserver.deployment_config_parser import DeploymentConfig
from llama_deploy.apiserver.source_managers.base import SyncPolicy
from llama_deploy.apiserver.source_managers.local import LocalSourceManager
def config(data_path: Path) -> D... | ValueError) | pytest.raises | variable | tests/apiserver/source_managers/test_local.py | test_absolute_path | 59 | null | |
run-llama/llama_deploy | import os
from pathlib import Path
from unittest.mock import MagicMock, mock_open, patch
import pytest
from click.testing import CliRunner
from tenacity import RetryError
from llama_deploy.apiserver.settings import settings
from llama_deploy.cli.serve import serve
def runner() -> CliRunner:
"""Fixture for invoki... | True | assert | bool_literal | tests/cli/test_serve.py | test_serve_with_deployment_file | 129 | null | |
run-llama/llama_deploy | import asyncio
import json
import subprocess
import sys
from collections.abc import Generator
from copy import deepcopy
from pathlib import Path
from typing import Any
from unittest import mock
import pytest
from workflows import Context, Workflow
from workflows.handler import WorkflowHandler
from llama_deploy.apiser... | [] | assert | collection | tests/apiserver/test_deployment.py | test__install_dependencies | 124 | null | |
run-llama/llama_deploy | from unittest import mock
import pytest
from llama_deploy.client import Client
from llama_deploy.client.client import _SyncClient
from llama_deploy.client.models import ApiServer
def test_client_sync() -> None:
c = Client()
sc = c.sync
assert type(sc) is | _SyncClient | assert | variable | tests/client/test_client.py | test_client_sync | 26 | null | |
run-llama/llama_deploy | import io
from typing import Any
from unittest import mock
import httpx
import pytest
from llama_deploy.client.models.apiserver import (
ApiServer,
Deployment,
DeploymentCollection,
SessionCollection,
Task,
TaskCollection,
)
from llama_deploy.types import SessionDefinition, TaskDefinition, Tas... | "Healthy" | assert | string_literal | tests/client/models/test_apiserver.py | test_status_healthy_no_deployments | 284 | null | |
run-llama/llama_deploy | import asyncio
from typing import AsyncGenerator
import pytest
from llama_deploy.client import Client
from llama_deploy.client.models import Collection, Model
from llama_deploy.client.models.model import _async_gen_to_list, make_sync
@pytest.mark.asyncio
async def test__async_gen_to_list() -> None:
async def ait... | ["one", "two"] | assert | collection | tests/client/models/test_model.py | test__async_gen_to_list | 60 | null | |
run-llama/llama_deploy | from __future__ import annotations
import json
from pathlib import Path
from types import TracebackType
from typing import Generator, Optional
from unittest import mock
from unittest.mock import MagicMock, patch
import httpx
import pytest
import respx
from fastapi.testclient import TestClient
from workflows.context i... | 400 | assert | numeric_literal | tests/apiserver/routers/test_deployments.py | test_run_task_no_default_service | 97 | null | |
run-llama/llama_deploy | import asyncio
import json
import subprocess
import sys
from collections.abc import Generator
from copy import deepcopy
from pathlib import Path
from typing import Any
from unittest import mock
import pytest
from workflows import Context, Workflow
from workflows.handler import WorkflowHandler
from llama_deploy.apiser... | 3 | assert | numeric_literal | tests/apiserver/test_deployment.py | test__install_dependencies_uv_not_available_bootstrap_success | 303 | null | |
run-llama/llama_deploy | import io
from typing import Any
from unittest import mock
import httpx
import pytest
from llama_deploy.client.models.apiserver import (
ApiServer,
Deployment,
DeploymentCollection,
SessionCollection,
Task,
TaskCollection,
)
from llama_deploy.types import SessionDefinition, TaskDefinition, Tas... | "http://localhost:4501/deployments/a_deployment/tasks/create") | assert_* | string_literal | tests/client/models/test_apiserver.py | test_task_collection_create | 160 | null | |
run-llama/llama_deploy | import os
import subprocess
import time
import requests
def test_apiserver_entrypoint():
# Customize host and port
env = os.environ.copy()
env["LLAMA_DEPLOY_APISERVER_HOST"] = "localhost"
env["LLAMA_DEPLOY_APISERVER_PORT"] = "4502"
# Start the API server as a subprocess
process = subprocess.Po... | 200 | assert | numeric_literal | e2e_tests/apiserver/test_service_entrypoint.py | test_apiserver_entrypoint | 26 | null | |
run-llama/llama_deploy | import asyncio
import json
import subprocess
import sys
from collections.abc import Generator
from copy import deepcopy
from pathlib import Path
from typing import Any
from unittest import mock
import pytest
from workflows import Context, Workflow
from workflows.handler import WorkflowHandler
from llama_deploy.apiser... | None | assert | none_literal | tests/apiserver/test_deployment.py | test_manager_serve_loop | 510 | null | |
run-llama/llama_deploy | import asyncio
import json
import subprocess
import sys
from collections.abc import Generator
from copy import deepcopy
from pathlib import Path
from typing import Any
from unittest import mock
import pytest
from workflows import Context, Workflow
from workflows.handler import WorkflowHandler
from llama_deploy.apiser... | 2 | assert | numeric_literal | tests/apiserver/test_deployment.py | test_deployment_ctor_skip_default_service | 85 | null | |
run-llama/llama_deploy | from pathlib import Path
import pytest
from llama_deploy.types import TaskDefinition
@pytest.mark.asyncio
async def test_stream(apiserver, client):
here = Path(__file__).parent
deployment_fp = here / "deployments" / "deployment_streaming.yml"
with open(deployment_fp) as f:
deployment = await clie... | 3 | assert | numeric_literal | e2e_tests/apiserver/test_streaming.py | test_stream | 23 | null | |
run-llama/llama_deploy | import io
from typing import Any
from unittest import mock
import httpx
import pytest
from llama_deploy.client.models.apiserver import (
ApiServer,
Deployment,
DeploymentCollection,
SessionCollection,
Task,
TaskCollection,
)
from llama_deploy.types import SessionDefinition, TaskDefinition, Tas... | "http://localhost:4501/status/") | assert_* | string_literal | tests/client/models/test_apiserver.py | test_status_down | 250 | null | |
run-llama/llama_deploy | import os
from pathlib import Path
from unittest.mock import MagicMock, mock_open, patch
import pytest
from click.testing import CliRunner
from tenacity import RetryError
from llama_deploy.apiserver.settings import settings
from llama_deploy.cli.serve import serve
def runner() -> CliRunner:
"""Fixture for invoki... | "rb") | assert_* | string_literal | tests/cli/test_serve.py | test_serve_with_deployment_file | 121 | null | |
run-llama/llama_deploy | from pathlib import Path
import pytest
from llama_deploy.types.core import TaskDefinition
@pytest.mark.asyncio
async def test_read_env_vars_local(apiserver, client):
here = Path(__file__).parent
deployment_fp = here / "deployments" / "deployment_env_local.yml"
with open(deployment_fp) as f:
deplo... | "var_1: z, var_2: y, api_key: 123" | assert | string_literal | e2e_tests/apiserver/test_env_vars_local.py | test_read_env_vars_local | 21 | null | |
run-llama/llama_deploy | from pathlib import Path
from unittest import mock
import httpx
from click.testing import CliRunner
from llama_deploy.cli import llamactl
def test_deploy_failed(runner: CliRunner, data_path: Path) -> None:
test_config_file = data_path / "deployment.yaml"
with mock.patch("llama_deploy.cli.deploy.Client") as m... | "Error: Unauthorized!\n" | assert | string_literal | tests/cli/test_deploy.py | test_deploy_failed | 42 | null | |
run-llama/llama_deploy | from unittest import mock
from click.testing import CliRunner
from llama_deploy.cli import llamactl
from llama_deploy.cli.__main__ import main
def test_wrong_profile(runner: CliRunner) -> None:
result = runner.invoke(llamactl, ["-p", "foo"])
assert result.exit_code == | 1 | assert | numeric_literal | tests/cli/test_cli.py | test_wrong_profile | 26 | null | |
run-llama/llama_deploy | from __future__ import annotations
import json
from pathlib import Path
from types import TracebackType
from typing import Generator, Optional
from unittest import mock
from unittest.mock import MagicMock, patch
import httpx
import pytest
import respx
from fastapi.testclient import TestClient
from workflows.context i... | 1 | assert | numeric_literal | tests/apiserver/routers/test_deployments.py | test_get_tasks | 351 | null | |
run-llama/llama_deploy | import asyncio
from pathlib import Path
import pytest
from workflows.events import HumanResponseEvent
from llama_deploy.types import TaskDefinition
@pytest.mark.asyncio
async def test_hitl(apiserver, client):
here = Path(__file__).parent
deployment_fp = here / "deployments" / "deployment_hitl.yml"
with o... | "hitl_workflow" | assert | string_literal | e2e_tests/apiserver/test_hitl.py | test_hitl | 28 | null | |
run-llama/llama_deploy | from unittest import mock
import httpx
from click.testing import CliRunner
from llama_deploy.cli import llamactl
def test_sessions_create_error(runner: CliRunner) -> None:
with mock.patch("llama_deploy.cli.sessions.Client") as mocked_client:
mocked_client.return_value.sync.apiserver.deployments.get.side_... | 1 | assert | numeric_literal | tests/cli/test_sessions.py | test_sessions_create_error | 44 | null | |
run-llama/llama_deploy | import os
from pathlib import Path
from unittest.mock import MagicMock, mock_open, patch
import pytest
from click.testing import CliRunner
from tenacity import RetryError
from llama_deploy.apiserver.settings import settings
from llama_deploy.cli.serve import serve
def runner() -> CliRunner:
"""Fixture for invoki... | 1 | assert | numeric_literal | tests/cli/test_serve.py | test_serve_deployment_creation_fails | 161 | null | |
run-llama/llama_deploy | import os
from pathlib import Path
from unittest.mock import MagicMock, mock_open, patch
import pytest
from click.testing import CliRunner
from tenacity import RetryError
from llama_deploy.apiserver.settings import settings
from llama_deploy.cli.serve import serve
def runner() -> CliRunner:
"""Fixture for invoki... | 0 | assert | numeric_literal | tests/cli/test_serve.py | test_serve_no_deployment_file | 45 | null | |
run-llama/llama_deploy | from unittest import mock
import httpx
from click.testing import CliRunner
from llama_deploy.cli import llamactl
from llama_deploy.types import TaskDefinition
def test_run(runner: CliRunner) -> None:
with mock.patch("llama_deploy.cli.run.Client") as mocked_client:
mocked_deployment = mock.MagicMock()
... | actual.service_id | assert | complex_expr | tests/cli/test_run.py | test_run | 31 | null | |
run-llama/llama_deploy | import io
from typing import Any
from unittest import mock
import httpx
import pytest
from llama_deploy.client.models.apiserver import (
ApiServer,
Deployment,
DeploymentCollection,
SessionCollection,
Task,
TaskCollection,
)
from llama_deploy.types import SessionDefinition, TaskDefinition, Tas... | "http://localhost:4501/deployments/a_deployment/tasks/run") | assert_* | string_literal | tests/client/models/test_apiserver.py | test_task_collection_run | 128 | null | |
run-llama/llama_deploy | import pytest
@pytest.mark.asyncio
async def test_status_up(apiserver, client):
res = await client.apiserver.status()
assert res.status.value == | "Healthy" | assert | string_literal | e2e_tests/apiserver/test_status.py | test_status_up | 18 | null | |
run-llama/llama_deploy | from pathlib import Path
from unittest import mock
import httpx
from click.testing import CliRunner
from llama_deploy.cli import llamactl
def test_deploy(runner: CliRunner, data_path: Path) -> None:
test_config_file = data_path / "deployment.yaml"
mocked_result = mock.MagicMock(id="test_deployment")
with... | file_arg.args[0].name | assert | complex_expr | tests/cli/test_deploy.py | test_deploy | 28 | null | |
run-llama/llama_deploy | from pathlib import Path
from llama_deploy.apiserver.deployment_config_parser import DeploymentConfig
def do_assert(config: DeploymentConfig) -> None:
assert config.name == "MyDeployment"
assert config.default_service == "myworkflow"
wf_config = config.services["myworkflow"]
assert wf_config.name == ... | "git" | assert | string_literal | tests/apiserver/test_config_parser.py | do_assert | 13 | null | |
run-llama/llama_deploy | from pathlib import Path
import pytest
def test_deploy_sync(apiserver, client):
here = Path(__file__).parent
deployment_fp = here / "deployments" / "deployment1.yml"
with open(deployment_fp) as f:
client.sync.apiserver.deployments.create(f, base_path=deployment_fp.parent)
assert "TestDeploym... | client.sync.apiserver.status().deployments | assert | func_call | e2e_tests/apiserver/test_deploy.py | test_deploy_sync | 23 | null | |
run-llama/llama_deploy | from unittest import mock
from click.testing import CliRunner
from llama_deploy.cli import llamactl
from llama_deploy.types.apiserver import Status, StatusEnum
def test_status_server_down(runner: CliRunner) -> None:
with mock.patch("llama_deploy.cli.status.Client") as mocked_client:
mocked_client.return_... | result.output | assert | complex_expr | tests/cli/test_status.py | test_status_server_down | 23 | null | |
run-llama/llama_deploy | from pathlib import Path
from unittest import mock
import pytest
from llama_deploy.apiserver.deployment_config_parser import DeploymentConfig
from llama_deploy.apiserver.source_managers.base import SyncPolicy
from llama_deploy.apiserver.source_managers.local import LocalSourceManager
def config(data_path: Path) -> D... | ValueError, match="Unable to copy source into dest: this was a test") | pytest.raises | complex_expr | tests/apiserver/source_managers/test_local.py | test_sync_error | 28 | null | |
run-llama/llama_deploy | from unittest import mock
import httpx
from click.testing import CliRunner
from llama_deploy.cli import llamactl
def test_session_create(runner: CliRunner) -> None:
with mock.patch("llama_deploy.cli.sessions.Client") as mocked_client:
mocked_deployment = mock.MagicMock()
mocked_deployment.session... | 0 | assert | numeric_literal | tests/cli/test_sessions.py | test_session_create | 29 | null | |
run-llama/llama_deploy | import pytest
@pytest.mark.asyncio
async def test_autodeploy(client, apiserver_with_rc):
status = await client.apiserver.status()
assert "AutoDeployed" in | status.deployments | assert | complex_expr | e2e_tests/apiserver/test_autodeploy.py | test_autodeploy | 7 | null | |
run-llama/llama_deploy | import io
from typing import Any
from unittest import mock
import httpx
import pytest
from llama_deploy.client.models.apiserver import (
ApiServer,
Deployment,
DeploymentCollection,
SessionCollection,
Task,
TaskCollection,
)
from llama_deploy.types import SessionDefinition, TaskDefinition, Tas... | "http://localhost:4501/deployments/") | assert_* | string_literal | tests/client/models/test_apiserver.py | test_deployments | 317 | null | |
run-llama/llama_deploy | from pathlib import Path
from unittest import mock
import httpx
from click.testing import CliRunner
from llama_deploy.cli import llamactl
def test_deploy(runner: CliRunner, data_path: Path) -> None:
test_config_file = data_path / "deployment.yaml"
mocked_result = mock.MagicMock(id="test_deployment")
with... | 0 | assert | numeric_literal | tests/cli/test_deploy.py | test_deploy | 20 | null | |
run-llama/llama_deploy | from pathlib import Path
from unittest import mock
import pytest
from llama_deploy.apiserver.deployment_config_parser import DeploymentConfig
from llama_deploy.apiserver.source_managers.base import SyncPolicy
from llama_deploy.apiserver.source_managers.local import LocalSourceManager
def config(data_path: Path) -> D... | ValueError, match="Destination cannot be empty") | pytest.raises | complex_expr | tests/apiserver/source_managers/test_local.py | test_dest_missing | 18 | null | |
run-llama/llama_deploy | import os
import tempfile
import pytest
from click.testing import CliRunner
from llama_deploy.cli import llamactl
def runner() -> CliRunner:
return CliRunner()
def test_basic_init_e2e(runner: CliRunner) -> None:
with tempfile.TemporaryDirectory() as temp_dir:
result = runner.invoke(
llam... | 0 | assert | numeric_literal | tests/cli/test_init.py | test_basic_init_e2e | 30 | null | |
run-llama/llama_deploy | from pathlib import Path
from unittest import mock
from llama_deploy.cli.internal.config import (
Config,
ConfigProfile,
_default_config_path,
load_config,
)
from llama_deploy.cli.internal.utils import DEFAULT_CONFIG_FILE_NAME
def test_load_config(data_path: Path) -> None:
test_config_file = data_... | config.profiles | assert | complex_expr | tests/cli/internal/test_config.py | test_load_config | 16 | null | |
run-llama/llama_deploy | import asyncio
from typing import AsyncGenerator
import pytest
from llama_deploy.client import Client
from llama_deploy.client.models import Collection, Model
from llama_deploy.client.models.model import _async_gen_to_list, make_sync
def test_make_sync_instance(client: Client) -> None:
some_sync = make_sync(Some... | [4, 2] | assert | collection | tests/client/models/test_model.py | test_make_sync_instance | 30 | null | |
run-llama/llama_deploy | import io
from typing import Any
from unittest import mock
import httpx
import pytest
from llama_deploy.client.models.apiserver import (
ApiServer,
Deployment,
DeploymentCollection,
SessionCollection,
Task,
TaskCollection,
)
from llama_deploy.types import SessionDefinition, TaskDefinition, Tas... | "http://localhost:4501/deployments/create") | assert_* | string_literal | tests/client/models/test_apiserver.py | test_task_deployment_collection_create | 217 | null | |
run-llama/llama_deploy | import pytest
@pytest.mark.asyncio
async def test_status_down(client):
res = await client.apiserver.status()
assert res.status.value == | "Down" | assert | string_literal | e2e_tests/apiserver/test_status.py | test_status_down | 7 | null | |
run-llama/llama_deploy | from typing import Any
from unittest import mock
import httpx
from fastapi.testclient import TestClient
from llama_deploy.apiserver.settings import settings
def test_read_main(http_client: TestClient) -> None:
response = http_client.get("/status")
assert response.status_code == | 200 | assert | numeric_literal | tests/apiserver/routers/test_status.py | test_read_main | 12 | null | |
run-llama/llama_deploy | from llama_deploy.apiserver.settings import ApiserverSettings
def test_settings_url() -> None:
s = ApiserverSettings()
assert s.url == "http://127.0.0.1:4501"
s = ApiserverSettings(use_tls=True)
assert s.url == "https://127.0.0.1:4501"
s = ApiserverSettings(host="example.com", port=8080)
asse... | "http://example.com" | assert | string_literal | tests/apiserver/test_settings.py | test_settings_url | 15 | null | |
run-llama/llama_deploy | import io
from typing import Any
from unittest import mock
import httpx
import pytest
from llama_deploy.client.models.apiserver import (
ApiServer,
Deployment,
DeploymentCollection,
SessionCollection,
Task,
TaskCollection,
)
from llama_deploy.types import SessionDefinition, TaskDefinition, Tas... | "This is a drill." | assert | string_literal | tests/client/models/test_apiserver.py | test_status_unhealthy | 269 | null | |
run-llama/llama_deploy | from pathlib import Path
from unittest import mock
import pytest
from llama_deploy.apiserver.deployment_config_parser import DeploymentConfig
from llama_deploy.apiserver.source_managers.git import GitSourceManager
def config(data_path: Path) -> DeploymentConfig:
return DeploymentConfig.from_yaml(data_path / "git... | ValueError, match="Destination cannot be empty") | pytest.raises | complex_expr | tests/apiserver/source_managers/test_git.py | test_sync_wrong_params | 29 | null | |
run-llama/llama_deploy | from pathlib import Path
import pytest
@pytest.mark.asyncio
async def test_deploy(apiserver, client):
here = Path(__file__).parent
deployment_fp = here / "deployments" / "deployment1.yml"
with open(deployment_fp) as f:
await client.apiserver.deployments.create(f, base_path=deployment_fp.parent)
... | status.deployments | assert | complex_expr | e2e_tests/apiserver/test_deploy.py | test_deploy | 14 | null | |
run-llama/llama_deploy | from unittest import mock
from click.testing import CliRunner
from llama_deploy.cli import llamactl
from llama_deploy.cli.__main__ import main
@mock.patch("llama_deploy.cli.__main__.sys")
@mock.patch("llama_deploy.cli.__main__.llamactl")
def test_main(mocked_cli, mocked_sys) -> None: # type: ignore
mocked_cli.r... | 0) | assert_* | numeric_literal | tests/cli/test_cli.py | test_main | 14 | null | |
run-llama/llama_deploy | import os
from pathlib import Path
from unittest.mock import MagicMock, mock_open, patch
import pytest
from click.testing import CliRunner
from tenacity import RetryError
from llama_deploy.apiserver.settings import settings
from llama_deploy.cli.serve import serve
def runner() -> CliRunner:
"""Fixture for invoki... | result.output | assert | complex_expr | tests/cli/test_serve.py | test_serve_deployment_creation_fails | 162 | null | |
run-llama/llama_deploy | from unittest import mock
import httpx
from click.testing import CliRunner
from llama_deploy.cli import llamactl
from llama_deploy.types import TaskDefinition
def test_run(runner: CliRunner) -> None:
with mock.patch("llama_deploy.cli.run.Client") as mocked_client:
mocked_deployment = mock.MagicMock()
... | None | assert | none_literal | tests/cli/test_run.py | test_run | 32 | null | |
run-llama/llama_deploy | from unittest import mock
import pytest
from llama_deploy.client import Client
from llama_deploy.client.client import _SyncClient
from llama_deploy.client.models import ApiServer
def test_client_init_default() -> None:
c = Client()
assert c.api_server_url == "http://localhost:4501"
assert c.disable_ssl ... | False | assert | bool_literal | tests/client/test_client.py | test_client_init_default | 13 | null | |
run-llama/llama_deploy | from pathlib import Path
import pytest
from click.testing import CliRunner
from llama_deploy.cli import llamactl
@pytest.mark.parametrize(
"profile,expected_code,expected_output",
[
("default", 0, ""), # Switch to existing profile
("nonexistent", 1, "Cannot find profile 'nonexistent'"), # I... | expected_code | assert | variable | tests/cli/test_config.py | test_use_profile | 40 | null | |
run-llama/llama_deploy | import asyncio
from typing import AsyncGenerator
import pytest
from llama_deploy.client import Client
from llama_deploy.client.models import Collection, Model
from llama_deploy.client.models.model import _async_gen_to_list, make_sync
def test_make_sync_instance(client: Client) -> None:
some_sync = make_sync(Some... | 1 | assert | numeric_literal | tests/client/models/test_model.py | test_make_sync_instance | 29 | null | |
run-llama/llama_deploy | from pathlib import Path
from llama_deploy.apiserver.deployment_config_parser import DeploymentConfig
def do_assert(config: DeploymentConfig) -> None:
assert config.name == "MyDeployment"
assert config.default_service == "myworkflow"
wf_config = config.services["myworkflow"]
assert wf_config.name == ... | 2 | assert | numeric_literal | tests/apiserver/test_config_parser.py | do_assert | 30 | null | |
run-llama/llama_deploy | from pathlib import Path
from unittest import mock
import httpx
from click.testing import CliRunner
from llama_deploy.cli import llamactl
def test_deploy(runner: CliRunner, data_path: Path) -> None:
test_config_file = data_path / "deployment.yaml"
mocked_result = mock.MagicMock(id="test_deployment")
with... | "Deployment successful: test_deployment\n" | assert | string_literal | tests/cli/test_deploy.py | test_deploy | 21 | null | |
run-llama/llama_deploy | from __future__ import annotations
import json
from pathlib import Path
from types import TracebackType
from typing import Generator, Optional
from unittest import mock
from unittest.mock import MagicMock, patch
import httpx
import pytest
import respx
from fastapi.testclient import TestClient
from workflows.context i... | [] | assert | collection | tests/apiserver/routers/test_deployments.py | test_read_deployments | 36 | null | |
run-llama/llama_deploy | import os
import tempfile
import pytest
from click.testing import CliRunner
from llama_deploy.cli import llamactl
def runner() -> CliRunner:
return CliRunner()
def test_basic_init_e2e(runner: CliRunner) -> None:
with tempfile.TemporaryDirectory() as temp_dir:
result = runner.invoke(
llam... | text | assert | variable | tests/cli/test_init.py | test_basic_init_e2e | 35 | null | |
run-llama/llama_deploy | from pathlib import Path
import pytest
from click.testing import CliRunner
from llama_deploy.cli import llamactl
def test_get_profiles(runner: CliRunner) -> None:
result = runner.invoke(llamactl, ["config", "get-profiles"])
assert result.exit_code == 0
# Verify default profile is shown
assert "defau... | result.output | assert | complex_expr | tests/cli/test_config.py | test_get_profiles | 13 | null | |
run-llama/llama_deploy | import asyncio
import json
import subprocess
import sys
from collections.abc import Generator
from copy import deepcopy
from pathlib import Path
from typing import Any
from unittest import mock
import pytest
from workflows import Context, Workflow
from workflows.handler import WorkflowHandler
from llama_deploy.apiser... | mock_context | assert | variable | tests/apiserver/test_deployment.py | test_run_workflow_no_wait_without_session_id | 790 | null | |
run-llama/llama_deploy | from unittest import mock
import httpx
from click.testing import CliRunner
from llama_deploy.cli import llamactl
from llama_deploy.types import TaskDefinition
def test_run(runner: CliRunner) -> None:
with mock.patch("llama_deploy.cli.run.Client") as mocked_client:
mocked_deployment = mock.MagicMock()
... | 0 | assert | numeric_literal | tests/cli/test_run.py | test_run | 33 | null | |
run-llama/llama_deploy | import asyncio
import json
import subprocess
import sys
from collections.abc import Generator
from copy import deepcopy
from pathlib import Path
from typing import Any
from unittest import mock
import pytest
from workflows import Context, Workflow
from workflows.handler import WorkflowHandler
from llama_deploy.apiser... | 1 | assert | numeric_literal | tests/apiserver/test_deployment.py | test_deployment_ctor | 61 | null | |
run-llama/llama_deploy | from unittest import mock
from click.testing import CliRunner
from llama_deploy.cli import llamactl
from llama_deploy.types.apiserver import Status, StatusEnum
def test_status_server_down(runner: CliRunner) -> None:
with mock.patch("llama_deploy.cli.status.Client") as mocked_client:
mocked_client.return_... | 0 | assert | numeric_literal | tests/cli/test_status.py | test_status_server_down | 22 | null | |
run-llama/llama_deploy | import asyncio
from pathlib import Path
import pytest
from workflows.events import HumanResponseEvent
from llama_deploy.types import TaskDefinition
@pytest.mark.asyncio
async def test_hitl(apiserver, client):
here = Path(__file__).parent
deployment_fp = here / "deployments" / "deployment_hitl.yml"
with o... | "42" | assert | string_literal | e2e_tests/apiserver/test_hitl.py | test_hitl | 29 | null | |
run-llama/llama_deploy | import os
import tempfile
import pytest
from click.testing import CliRunner
from llama_deploy.cli import llamactl
def runner() -> CliRunner:
return CliRunner()
def test_basic_init_e2e(runner: CliRunner) -> None:
with tempfile.TemporaryDirectory() as temp_dir:
result = runner.invoke(
llam... | result.output | assert | complex_expr | tests/cli/test_init.py | test_basic_init_e2e | 31 | null | |
run-llama/llama_deploy | from llama_deploy.apiserver.settings import ApiserverSettings
def test_settings_url() -> None:
s = ApiserverSettings()
assert s.url == "http://127.0.0.1:4501"
s = ApiserverSettings(use_tls=True)
assert s.url == "https://127.0.0.1:4501"
s = ApiserverSettings(host="example.com", port=8080)
ass... | "http://example.com:8080" | assert | string_literal | tests/apiserver/test_settings.py | test_settings_url | 12 | null | |
run-llama/llama_deploy | from unittest import mock
import pytest
from llama_deploy.client import Client
from llama_deploy.client.client import _SyncClient
from llama_deploy.client.models import ApiServer
def test_client_init_default() -> None:
c = Client()
assert c.api_server_url == "http://localhost:4501"
assert c.disable_ssl i... | 0.5 | assert | numeric_literal | tests/client/test_client.py | test_client_init_default | 15 | null | |
run-llama/llama_deploy | import json
from pathlib import Path
import pytest
from llama_deploy.types.core import TaskDefinition
@pytest.mark.asyncio
async def test_read_env_vars_git(apiserver, client):
here = Path(__file__).parent
deployment_fp = here / "deployments" / "deployment_env_git.yml"
with open(deployment_fp) as f:
... | "VAR_1: x, VAR_2: y, API_KEY: 123" | assert | string_literal | e2e_tests/apiserver/test_env_vars_git.py | test_read_env_vars_git | 23 | null | |
run-llama/llama_deploy | import asyncio
from typing import AsyncGenerator
import pytest
from llama_deploy.client import Client
from llama_deploy.client.models import Collection, Model
from llama_deploy.client.models.model import _async_gen_to_list, make_sync
def test_collection_get() -> None:
class MyCollection(Collection):
pass... | "foo" | assert | string_literal | tests/client/models/test_model.py | test_collection_get | 50 | null | |
run-llama/llama_deploy | from unittest import mock
import pytest
from llama_deploy.client import Client
from llama_deploy.client.client import _SyncClient
from llama_deploy.client.models import ApiServer
@pytest.mark.asyncio
async def test_client_sync_within_loop() -> None:
c = Client()
with | RuntimeError, match="You cannot use the sync client within an async event loop - just await the async methods directly.") | pytest.raises | complex_expr | tests/client/test_client.py | test_client_sync_within_loop | 36 | null | |
run-llama/llama_deploy | import os
from pathlib import Path
from unittest.mock import MagicMock, mock_open, patch
import pytest
from click.testing import CliRunner
from tenacity import RetryError
from llama_deploy.apiserver.settings import settings
from llama_deploy.cli.serve import serve
def runner() -> CliRunner:
"""Fixture for invoki... | 9090) | assert_* | numeric_literal | tests/cli/test_serve.py | test_serve_prometheus_enabled | 77 | null | |
run-llama/llama_deploy | import io
from typing import Any
from unittest import mock
import httpx
import pytest
from llama_deploy.client.models.apiserver import (
ApiServer,
Deployment,
DeploymentCollection,
SessionCollection,
Task,
TaskCollection,
)
from llama_deploy.types import SessionDefinition, TaskDefinition, Tas... | "http://localhost:4501/deployments/a_deployment/sessions") | assert_* | string_literal | tests/client/models/test_apiserver.py | test_session_collection_list | 76 | null | |
run-llama/llama_deploy | from fastapi.testclient import TestClient
def test_read_main(http_client: TestClient) -> None:
response = http_client.get("/")
assert response.status_code == 200
assert set(response.json().keys()) == | {"swagger_docs", "status"} | assert | collection | tests/apiserver/test_app.py | test_read_main | 7 | null | |
run-llama/llama_deploy | from fastapi.testclient import TestClient
def test_read_main(http_client: TestClient) -> None:
response = http_client.get("/")
assert response.status_code == | 200 | assert | numeric_literal | tests/apiserver/test_app.py | test_read_main | 6 | null | |
run-llama/llama_deploy | from pathlib import Path
from unittest import mock
from llama_deploy.cli.internal.config import (
Config,
ConfigProfile,
_default_config_path,
load_config,
)
from llama_deploy.cli.internal.utils import DEFAULT_CONFIG_FILE_NAME
def test_load_config_no_path(tmp_path: Path) -> None:
with mock.patch("... | 1 | assert | numeric_literal | tests/cli/internal/test_config.py | test_load_config_no_path | 23 | null | |
run-llama/llama_deploy | from unittest import mock
import httpx
from click.testing import CliRunner
from llama_deploy.cli import llamactl
from llama_deploy.types import TaskDefinition
def test_run_error(runner: CliRunner) -> None:
with mock.patch("llama_deploy.cli.run.Client") as mocked_client:
err_response = mock.MagicMock()
... | 1 | assert | numeric_literal | tests/cli/test_run.py | test_run_error | 48 | null | |
vstorm-co/pydantic-deepagents | from __future__ import annotations
import asyncio
from dataclasses import dataclass
from typing import Any
import pytest
from pydantic_ai import Agent
from pydantic_ai.models.test import TestModel
from pydantic_ai_backends import ExecuteResponse, SandboxProtocol, StateBackend
from pydantic_deep import DeepAgentDeps,... | 2 | assert | numeric_literal | tests/test_hooks.py | test_constants | TestExitCodes | 202 | null |
vstorm-co/pydantic-deepagents | from __future__ import annotations
import json
from unittest.mock import MagicMock
import pytest
from pydantic_ai_backends import StateBackend
from pydantic_ai_backends.types import ExecuteResponse
from pydantic_deep.toolsets.skills.backend import (
BackendSkillResource,
BackendSkillScript,
BackendSkillS... | 2 | assert | numeric_literal | tests/test_skills_backend.py | test_discover_with_resources | TestBackendSkillsDirectory | 526 | null |
vstorm-co/pydantic-deepagents | from __future__ import annotations
import json
from unittest.mock import MagicMock
import pytest
from pydantic_ai_backends import StateBackend
from pydantic_ai_backends.types import ExecuteResponse
from pydantic_deep.toolsets.skills.backend import (
BackendSkillResource,
BackendSkillScript,
BackendSkillS... | "" | assert | string_literal | tests/test_skills_backend.py | test_get_relative_path_exact_match | TestUtilityFunctions | 87 | null |
vstorm-co/pydantic-deepagents | from __future__ import annotations
import asyncio
from dataclasses import dataclass
from typing import Any
import pytest
from pydantic_ai import Agent
from pydantic_ai.models.test import TestModel
from pydantic_ai_backends import ExecuteResponse, SandboxProtocol, StateBackend
from pydantic_deep import DeepAgentDeps,... | 1 | assert | numeric_literal | tests/test_hooks.py | test_match_by_event | TestMatchHooks | 215 | null |
vstorm-co/pydantic-deepagents | from __future__ import annotations
from pathlib import Path
from typing import Any
import pytest
from pydantic_ai import Agent
from pydantic_ai.models.test import TestModel
from pydantic_deep import create_deep_agent
from pydantic_deep.styles import (
BUILTIN_STYLES,
CONCISE_STYLE,
CONVERSATIONAL_STYLE,
... | 1 | assert | numeric_literal | tests/test_styles.py | test_discover_skips_invalid | TestDiscoverStyles | 261 | null |
vstorm-co/pydantic-deepagents | from pydantic_ai_todo import TodoItem
from subagents_pydantic_ai import (
SubAgentConfig,
create_subagent_toolset,
get_subagent_system_prompt,
)
class TestTodoToolsetExtended:
def test_todo_item_model(self):
"""Test TodoItem pydantic model."""
item = TodoItem(
content="Test... | "pending" | assert | string_literal | tests/test_toolsets_extended.py | test_todo_item_model | TestTodoToolsetExtended | 22 | null |
vstorm-co/pydantic-deepagents | from __future__ import annotations
import asyncio
from dataclasses import dataclass
from typing import Any
import pytest
from pydantic_ai import Agent
from pydantic_ai.models.test import TestModel
from pydantic_ai_backends import ExecuteResponse, SandboxProtocol, StateBackend
from pydantic_deep import DeepAgentDeps,... | 30 | assert | numeric_literal | tests/test_hooks.py | test_hook_with_command | TestHookValidation | 99 | null |
vstorm-co/pydantic-deepagents | from pydantic_ai_backends import StateBackend, create_console_toolset, get_console_system_prompt
from pydantic_ai_todo import create_todo_toolset, get_todo_system_prompt
from pydantic_deep.deps import DeepAgentDeps
from pydantic_deep.types import Todo
class TestConsoleToolset:
def test_create_without_execute(sel... | None | assert | none_literal | tests/test_toolsets.py | test_create_without_execute | TestConsoleToolset | 62 | null |
vstorm-co/pydantic-deepagents | from pydantic_ai.models.test import TestModel
from pydantic_deep import (
DeepAgentDeps,
StateBackend,
create_deep_agent,
)
from pydantic_deep.types import Skill, SkillDirectory
TEST_MODEL = TestModel()
class TestDeepAgentDepsExtended:
def test_post_init_with_non_state_backend(self, local_backend):
... | {} | assert | collection | tests/test_agent_extended.py | test_post_init_with_non_state_backend | TestDeepAgentDepsExtended | 186 | null |
vstorm-co/pydantic-deepagents | from __future__ import annotations
import warnings
from pathlib import Path
from typing import Any
import pytest
from pydantic_ai._run_context import RunContext
from pydantic_ai.models.test import TestModel
from pydantic_ai.usage import RunUsage
from pydantic_deep import create_deep_agent
from pydantic_deep.toolsets... | 1 | assert | numeric_literal | tests/test_skills_extended.py | test_find_skill_files_unlimited | TestDiscoveryFunctions | 216 | null |
vstorm-co/pydantic-deepagents | from datetime import datetime, timezone
from unittest.mock import MagicMock
import pytest
from pydantic_ai.messages import (
ModelMessage,
ModelRequest,
ModelResponse,
TextPart,
ToolCallPart,
ToolReturnPart,
UserPromptPart,
)
from pydantic_ai.models.test import TestModel
from pydantic_ai.to... | 5000 | assert | numeric_literal | tests/test_eviction.py | test_custom_params | TestCreateEvictionProcessor | 683 | null |
vstorm-co/pydantic-deepagents | from __future__ import annotations
from pathlib import Path
from typing import Any
import pytest
from pydantic_ai import Agent
from pydantic_ai.models.test import TestModel
from pydantic_deep import create_deep_agent
from pydantic_deep.styles import (
BUILTIN_STYLES,
CONCISE_STYLE,
CONVERSATIONAL_STYLE,
... | None | assert | none_literal | tests/test_styles.py | test_output_style_importable | TestStyleExports | 420 | null |
vstorm-co/pydantic-deepagents | from __future__ import annotations
import asyncio
from dataclasses import dataclass
from typing import Any
import pytest
from pydantic_ai import Agent
from pydantic_ai.models.test import TestModel
from pydantic_ai_backends import ExecuteResponse, SandboxProtocol, StateBackend
from pydantic_deep import DeepAgentDeps,... | 0 | assert | numeric_literal | tests/test_hooks.py | test_constants | TestExitCodes | 201 | null |
vstorm-co/pydantic-deepagents | from __future__ import annotations
from pathlib import Path
from typing import Any
import pytest
from pydantic_ai import Agent
from pydantic_ai.models.test import TestModel
from pydantic_deep import create_deep_agent
from pydantic_deep.styles import (
BUILTIN_STYLES,
CONCISE_STYLE,
CONVERSATIONAL_STYLE,
... | {} | assert | collection | tests/test_styles.py | test_discover_empty_dir | TestDiscoverStyles | 267 | null |
vstorm-co/pydantic-deepagents | from __future__ import annotations
from pydantic_ai import Agent
from pydantic_ai.models.test import TestModel
from pydantic_ai_middleware import (
AgentMiddleware,
MiddlewareAgent,
MiddlewareChain,
MiddlewareContext,
ToolDecision,
ToolPermissionResult,
before_run,
)
from pydantic_deep imp... | 3 | assert | numeric_literal | tests/test_middleware_integration.py | test_middleware_with_all_params | TestCreateWithMiddleware | 126 | null |
vstorm-co/pydantic-deepagents | from pydantic_ai.models.test import TestModel
from pydantic_ai.tools import RunContext
from pydantic_ai.usage import RunUsage
from pydantic_ai_backends import StateBackend
from pydantic_deep import (
DEFAULT_CONTEXT_FILENAMES,
DEFAULT_MAX_CONTEXT_CHARS,
SUBAGENT_CONTEXT_ALLOWLIST,
ContextFile,
Cont... | 2 | assert | numeric_literal | tests/test_context.py | test_load_multiple_files | TestLoadContextFiles | 77 | null |
vstorm-co/pydantic-deepagents | from __future__ import annotations
from typing import Any
from unittest.mock import MagicMock
from pydantic_ai.messages import ModelMessage
from pydantic_ai.models.test import TestModel
from pydantic_ai_middleware import AgentMiddleware, MiddlewareAgent
from pydantic_ai_summarization import ContextManagerMiddleware
... | 0 | assert | numeric_literal | tests/test_context_manager.py | test_disabled_has_no_processors | TestContextManagerIntegration | 132 | null |
vstorm-co/pydantic-deepagents | from __future__ import annotations
import json
from unittest.mock import MagicMock
import pytest
from pydantic_ai_backends import StateBackend
from pydantic_ai_backends.types import ExecuteResponse
from pydantic_deep.toolsets.skills.backend import (
BackendSkillResource,
BackendSkillScript,
BackendSkillS... | "/" | assert | string_literal | tests/test_skills_backend.py | test_get_skill_dir_root | TestUtilityFunctions | 68 | null |
vstorm-co/pydantic-deepagents | from __future__ import annotations
import json
from pathlib import Path
from typing import Any
from unittest.mock import AsyncMock, MagicMock
import pytest
from pydantic_deep.toolsets.skills.exceptions import (
SkillException,
SkillNotFoundError,
SkillResourceLoadError,
SkillResourceNotFoundError,
... | "test" | assert | string_literal | tests/test_skills.py | test_basic_creation | TestSkill | 174 | null |
vstorm-co/pydantic-deepagents | from __future__ import annotations
import json
from unittest.mock import MagicMock
import pytest
from pydantic_ai_backends import StateBackend
from pydantic_ai_backends.types import ExecuteResponse
from pydantic_deep.toolsets.skills.backend import (
BackendSkillResource,
BackendSkillScript,
BackendSkillS... | 60 | assert | numeric_literal | tests/test_skills_backend.py | test_script_timeout_parameter | TestBackendSkillsDirectory | 679 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.