repo_id stringclasses 400
values | commit_sha stringclasses 400
values | commit_index int32 0 951 | in_repo_split stringclasses 1
value | cross_repo_split stringclasses 1
value | test_file stringlengths 7 121 | test_function stringlengths 1 108 | assertion_type stringclasses 32
values | difficulty stringclasses 8
values | context_lines int32 3 600 | prefix large_stringlengths 44 113k | target large_stringlengths 1 498 | anchor_sha stringclasses 400
values | anchor_index int32 0 951 | qna_source stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/server/test_server_persistence.py | test_resume_across_runs | assert | variable | 103 | import asyncio
from typing import AsyncGenerator
import pytest
from httpx import ASGITransport, AsyncClient
from workflows import Context
from workflows.events import Event, InternalDispatchEvent, StopEvent
from workflows.server import WorkflowServer
from workflows.server.abstract_workflow_store import HandlerQuery, P... | handler_id | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/server/test_main.py | test_no_file_path_argument | pytest.raises | variable | 13 | import os
from pathlib import Path
from typing import Any
from unittest.mock import patch
import pytest
from workflows.server.__main__ import run_server
def test_no_file_path_argument(capsys: Any) -> None:
"""Test that the script exits with usage message when no file path is provided."""
with patch("sys.argv"... | SystemExit) | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/test_utils.py | test_is_free_function | pytest.raises | variable | 30 | import inspect
from typing import Any, List, Optional, Union, get_type_hints
import pytest
from workflows.context import Context
from workflows.decorators import step
from workflows.errors import WorkflowValidationError
from workflows.events import StartEvent, StopEvent
from workflows.utils import (
_get_param_typ... | ValueError) | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/test_event.py | test_custom_event_with_fields_and_private_params | assert | string_literal | 23 | from typing import Any, cast
import pytest
from pydantic import PrivateAttr
from workflows.context import JsonSerializer
from workflows.events import (
Event,
StopEvent,
WorkflowCancelledEvent,
WorkflowFailedEvent,
WorkflowTimedOutEvent,
)
def test_custom_event_with_fields_and_private_params() -> ... | "" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/test_nanoid.py | test_nanoid_zero_length | assert | string_literal | 8 | from workflows.utils import _nanoid as nanoid
def test_nanoid_zero_length() -> None:
"""Test nanoid with zero length."""
result = nanoid(0)
assert len(result) == 0
assert result == | "" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/test_event.py | test_event_init_basic | assert | string_literal | 20 | from typing import Any, cast
import pytest
from pydantic import PrivateAttr
from workflows.context import JsonSerializer
from workflows.events import (
Event,
StopEvent,
WorkflowCancelledEvent,
WorkflowFailedEvent,
WorkflowTimedOutEvent,
)
def test_event_init_basic() -> None:
evt = Event(a=1, ... | "c" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/test_resources.py | f1 | assert | string_literal | 37 | import json
from pathlib import Path
from typing import Annotated, Optional
from unittest import mock
import pytest
from pydantic import BaseModel, Field
from workflows.decorators import step
from workflows.events import Event, StartEvent, StopEvent
from workflows.resource import (
Resource,
ResourceConfig,
... | "r" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/test_state_manager.py | test_state_manager_defaults | assert | string_literal | 50 | from typing import Any, Type, Union, cast
import pytest
from pydantic import (
BaseModel,
ConfigDict,
ValidationError,
field_serializer,
field_validator,
)
from workflows.context.serializers import BaseSerializer, JsonSerializer
from workflows.context.state_store import DictState, InMemoryStateStor... | "b" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/test_state_manager.py | test_state_manager_defaults | assert | string_literal | 53 | from typing import Any, Type, Union, cast
import pytest
from pydantic import (
BaseModel,
ConfigDict,
ValidationError,
field_serializer,
field_validator,
)
from workflows.context.serializers import BaseSerializer, JsonSerializer
from workflows.context.state_store import DictState, InMemoryStateStor... | "c" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-utils-workflow/tests/test_drawing.py | test_draw_all_possible_flows_mermaid_basic | assert_* | string_literal | 21 | from unittest.mock import MagicMock, mock_open, patch
import pytest
from llama_index.utils.workflow import (
draw_all_possible_flows,
draw_all_possible_flows_mermaid,
draw_most_recent_execution,
draw_most_recent_execution_mermaid,
)
from workflows.workflow import Workflow
def test_draw_all_possible_fl... | "w") | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/server/test_memory_workflow_store.py | test_update_and_query_returns_inserted_handler | assert | string_literal | 29 | from datetime import datetime, timezone
import pytest
from workflows.events import StopEvent
from workflows.server.abstract_workflow_store import HandlerQuery, PersistentHandler
from workflows.server.memory_workflow_store import MemoryWorkflowStore
@pytest.mark.asyncio
async def test_update_and_query_returns_inserted... | "h1" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/server/test_memory_workflow_store.py | test_update_on_conflict_overwrites_existing_row | assert | string_literal | 45 | from datetime import datetime, timezone
import pytest
from workflows.events import StopEvent
from workflows.server.abstract_workflow_store import HandlerQuery, PersistentHandler
from workflows.server.memory_workflow_store import MemoryWorkflowStore
@pytest.mark.asyncio
async def test_update_on_conflict_overwrites_exi... | "h2" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/server/test_sqlite_workflow_store.py | test_update_and_query_returns_inserted_handler | assert | string_literal | 30 | from pathlib import Path
import pytest
from workflows.events import StopEvent
from workflows.server.abstract_workflow_store import HandlerQuery, PersistentHandler
from workflows.server.sqlite.sqlite_workflow_store import SqliteWorkflowStore
@pytest.mark.asyncio
async def test_update_and_query_returns_inserted_handler... | "h1" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/server/test_sqlite_workflow_store.py | test_update_on_conflict_overwrites_existing_row | assert | string_literal | 46 | from pathlib import Path
import pytest
from workflows.events import StopEvent
from workflows.server.abstract_workflow_store import HandlerQuery, PersistentHandler
from workflows.server.sqlite.sqlite_workflow_store import SqliteWorkflowStore
@pytest.mark.asyncio
async def test_update_on_conflict_overwrites_existing_ro... | "h2" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/test_decorator.py | test_decorated_config | assert | string_literal | 17 | import re
import pytest
from workflows.decorators import step
from workflows.errors import WorkflowValidationError
from workflows.events import Event, StartEvent, StopEvent
from workflows.workflow import Workflow
def test_decorated_config(workflow: Workflow) -> None:
def f(self, ev: Event) -> Event: # type: igno... | "ev" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/test_handler.py | test_str | assert | string_literal | 14 | from unittest import mock
import pytest
from workflows.context import Context
from workflows.errors import WorkflowRuntimeError
from workflows.handler import WorkflowHandler
@pytest.mark.asyncio
async def test_str() -> None:
ctx = mock.MagicMock(spec=Context)
h = WorkflowHandler(ctx=ctx)
h.set_result([])
... | "[]" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/test_workflow.py | test_human_in_the_loop | assert | string_literal | 60 | from __future__ import annotations
import asyncio
import gc
import logging
import pickle
import threading
import weakref
from typing import Any, Callable, Union, cast
from unittest import mock
import pytest
from llama_index_instrumentation.dispatcher import active_instrument_tags
from pydantic import PrivateAttr
from... | "42" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/context/test_context.py | test_wait_for_event_in_workflow | assert | string_literal | 51 | from __future__ import annotations
import asyncio
from typing import Optional, Union
import pytest
from pydantic import BaseModel
from workflows.context import Context
from workflows.context.state_store import DictState
from workflows.decorators import step
from workflows.errors import WorkflowRuntimeError
from workf... | "bar" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/protocol/test_serializable_events.py | test_parse_value_only_with_explicit_event | assert | string_literal | 24 | import json
import pytest
from workflows.events import (
Event,
StepState,
StepStateChanged,
StopEvent,
)
from workflows.protocol.serializable_events import (
EventEnvelope,
EventEnvelopeWithMetadata,
EventValidationError,
)
def test_parse_value_only_with_explicit_event() -> None:
clas... | "bar" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/test_streaming.py | test_task_raised | assert | string_literal | 29 | import asyncio
from typing import AsyncGenerator
import pytest
from workflows.context import Context
from workflows.decorators import step
from workflows.errors import WorkflowRuntimeError, WorkflowTimeoutError
from workflows.events import Event, StartEvent, StopEvent
from workflows.testing import WorkflowTestRunner
f... | "foo" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/client/test_client.py | test_send_event | assert | string_literal | 42 | import httpx
import pytest
from httpx import ASGITransport, AsyncClient
from workflows.client import WorkflowClient
from workflows.protocol.serializable_events import EventEnvelopeWithMetadata
from workflows.server.memory_workflow_store import MemoryWorkflowStore
from workflows.server.server import WorkflowServer
from... | "sent" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/runtime/test_control_loop.py | test_control_loop_retry_policy | assert | string_literal | 115 | import asyncio
import time
import uuid
from typing import Coroutine, Optional, Union
import pytest
import time_machine
from workflows.context import Context
from workflows.decorators import step
from workflows.errors import WorkflowCancelledByUser, WorkflowTimeoutError
from workflows.events import (
Event,
Hum... | "ok_2" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/server/test_idle_release_live_http.py | test_fast_idle_timeout_does_not_drop_valid_event | assert | string_literal | 45 | from __future__ import annotations
from datetime import timedelta
import pytest
from workflows import Context, Workflow, step
from workflows.client.client import WorkflowClient
from workflows.events import Event, StartEvent, StopEvent, WorkflowIdleEvent
from workflows.server import WorkflowServer
from workflows.serve... | "sent" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/server/test_memory_workflow_store.py | test_update_and_query_returns_inserted_handler | assert | string_literal | 30 | from datetime import datetime, timezone
import pytest
from workflows.events import StopEvent
from workflows.server.abstract_workflow_store import HandlerQuery, PersistentHandler
from workflows.server.memory_workflow_store import MemoryWorkflowStore
@pytest.mark.asyncio
async def test_update_and_query_returns_inserted... | "wf_a" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/server/test_server_live_http.py | test_streaming_over_real_http | assert | string_literal | 57 | from __future__ import annotations
import asyncio
import contextlib
from typing import AsyncGenerator
import pytest
from workflows import Workflow
from workflows.client.client import WorkflowClient
from workflows.events import StopEvent
from workflows.server import WorkflowServer
from .conftest import ( # type: ign... | "sent" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/server/test_server_persistence.py | test_store_is_updated_on_step_completion | assert | string_literal | 65 | import asyncio
from typing import AsyncGenerator
import pytest
from httpx import ASGITransport, AsyncClient
from workflows import Context
from workflows.events import Event, InternalDispatchEvent, StopEvent
from workflows.server import WorkflowServer
from workflows.server.abstract_workflow_store import HandlerQuery, P... | "test" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/server/test_sqlite_workflow_store.py | test_update_and_query_returns_inserted_handler | assert | string_literal | 31 | from pathlib import Path
import pytest
from workflows.events import StopEvent
from workflows.server.abstract_workflow_store import HandlerQuery, PersistentHandler
from workflows.server.sqlite.sqlite_workflow_store import SqliteWorkflowStore
@pytest.mark.asyncio
async def test_update_and_query_returns_inserted_handler... | "wf_a" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/server/test_sqlite_workflow_store.py | test_update_on_conflict_overwrites_existing_row | assert | string_literal | 47 | from pathlib import Path
import pytest
from workflows.events import StopEvent
from workflows.server.abstract_workflow_store import HandlerQuery, PersistentHandler
from workflows.server.sqlite.sqlite_workflow_store import SqliteWorkflowStore
@pytest.mark.asyncio
async def test_update_on_conflict_overwrites_existing_ro... | "wf_b" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/test_state_manager.py | test_default_state_manager_serialization | assert | string_literal | 46 | from typing import Any, Type, Union, cast
import pytest
from pydantic import (
BaseModel,
ConfigDict,
ValidationError,
field_serializer,
field_validator,
)
from workflows.context.serializers import BaseSerializer, JsonSerializer
from workflows.context.state_store import DictState, InMemoryStateStor... | "John" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/test_state_manager.py | test_custom_state_manager | assert | string_literal | 49 | from typing import Any, Type, Union, cast
import pytest
from pydantic import (
BaseModel,
ConfigDict,
ValidationError,
field_serializer,
field_validator,
)
from workflows.context.serializers import BaseSerializer, JsonSerializer
from workflows.context.state_store import DictState, InMemoryStateStor... | "Jane" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/test_testing_utils.py | test_testing_utils | assert | string_literal | 32 | import pytest
from workflows import Context, Workflow, step
from workflows.events import (
Event,
StartEvent,
StepStateChanged,
StopEvent,
)
from workflows.testing import WorkflowTestRunner
from workflows.testing.runner import WorkflowTestResult
@pytest.mark.asyncio
async def test_testing_utils() -> No... | "done" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/context/test_context.py | collector | assert | string_literal | 63 | from __future__ import annotations
import asyncio
from typing import Optional, Union
import pytest
from pydantic import BaseModel
from workflows.context import Context
from workflows.context.state_store import DictState
from workflows.decorators import step
from workflows.errors import WorkflowRuntimeError
from workf... | "first" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/runtime/test_identity_weak_ref.py | test_identity_weak_key_dict_removes_entry_when_object_unreferenced | assert | string_literal | 21 | from __future__ import annotations
import gc
import weakref
import pytest
from workflows.runtime.types._identity_weak_ref import IdentityWeakKeyDict
def test_identity_weak_key_dict_removes_entry_when_object_unreferenced() -> None:
with pytest.raises(TypeError):
hash(Unhashable())
d: IdentityWeakKeyD... | "value" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/server/test_server_persistence.py | test_store_is_updated_on_workflow_failure | assert | string_literal | 68 | import asyncio
from typing import AsyncGenerator
import pytest
from httpx import ASGITransport, AsyncClient
from workflows import Context
from workflows.events import Event, InternalDispatchEvent, StopEvent
from workflows.server import WorkflowServer
from workflows.server.abstract_workflow_store import HandlerQuery, P... | "error" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/workflows-dev/tests/test_workflows_dev_cli.py | test_current_version | assert | string_literal | 62 | from __future__ import annotations
import json
import subprocess
from pathlib import Path
from unittest.mock import Mock, patch
from urllib.error import HTTPError
from click.testing import CliRunner
from workflows_dev.changesets import (
PackageJson,
PyProjectContainer,
current_version,
is_published,
... | "1.2.3" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/workflows-dev/tests/test_workflows_dev_cli.py | test_pyproject_container_parse | assert | string_literal | 59 | from __future__ import annotations
import json
import subprocess
from pathlib import Path
from unittest.mock import Mock, patch
from urllib.error import HTTPError
from click.testing import CliRunner
from workflows_dev.changesets import (
PackageJson,
PyProjectContainer,
current_version,
is_published,
... | "0.1.0" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/workflows-dev/tests/test_workflows_dev_cli.py | test_sync_package_version_with_pyproject_updates_version | assert | string_literal | 75 | from __future__ import annotations
import json
import subprocess
from pathlib import Path
from unittest.mock import Mock, patch
from urllib.error import HTTPError
from click.testing import CliRunner
from workflows_dev.changesets import (
PackageJson,
PyProjectContainer,
current_version,
is_published,
... | "2.0.0" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/context/test_context.py | collector | assert | string_literal | 64 | from __future__ import annotations
import asyncio
from typing import Optional, Union
import pytest
from pydantic import BaseModel
from workflows.context import Context
from workflows.context.state_store import DictState
from workflows.decorators import step
from workflows.errors import WorkflowRuntimeError
from workf... | "second" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/protocol/test_serializable_events.py | test_envelope_stop_event_subclass | assert | string_literal | 26 | import json
import pytest
from workflows.events import (
Event,
StepState,
StepStateChanged,
StopEvent,
)
from workflows.protocol.serializable_events import (
EventEnvelope,
EventEnvelopeWithMetadata,
EventValidationError,
)
def test_envelope_stop_event_subclass() -> None:
class MyStop... | "MyStop" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/runtime/test_control_loop.py | test_control_loop_waiter_resolution | assert | string_literal | 129 | import asyncio
import time
import uuid
from typing import Coroutine, Optional, Union
import pytest
import time_machine
from workflows.context import Context
from workflows.decorators import step
from workflows.errors import WorkflowCancelledByUser, WorkflowTimeoutError
from workflows.events import (
Event,
Hum... | "got_go" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/runtime/test_control_loop.py | test_control_loop_collect_events_same_type | assert | string_literal | 104 | import asyncio
import time
import uuid
from typing import Coroutine, Optional, Union
import pytest
import time_machine
from workflows.context import Context
from workflows.decorators import step
from workflows.errors import WorkflowCancelledByUser, WorkflowTimeoutError
from workflows.events import (
Event,
Hum... | "sum_10" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/runtime/test_control_loop.py | test_control_loop_collect_events_multiple_types | assert | string_literal | 101 | import asyncio
import time
import uuid
from typing import Coroutine, Optional, Union
import pytest
import time_machine
from workflows.context import Context
from workflows.decorators import step
from workflows.errors import WorkflowCancelledByUser, WorkflowTimeoutError
from workflows.events import (
Event,
Hum... | "sum_33" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/runtime/test_control_loop.py | test_control_loop_per_step_routing | assert | string_literal | 119 | import asyncio
import time
import uuid
from typing import Coroutine, Optional, Union
import pytest
import time_machine
from workflows.context import Context
from workflows.decorators import step
from workflows.errors import WorkflowCancelledByUser, WorkflowTimeoutError
from workflows.events import (
Event,
Hum... | "second" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/server/test_server_persistence.py | test_startup_marks_invalid_persisted_context_as_failed | assert | string_literal | 76 | import asyncio
from typing import AsyncGenerator
import pytest
from httpx import ASGITransport, AsyncClient
from workflows import Context
from workflows.events import Event, InternalDispatchEvent, StopEvent
from workflows.server import WorkflowServer
from workflows.server.abstract_workflow_store import HandlerQuery, P... | "failed" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/test_resources.py | test_function_resource_init | assert | string_literal | 36 | import json
from pathlib import Path
from typing import Annotated, Optional
from unittest import mock
import pytest
from pydantic import BaseModel, Field
from workflows.decorators import step
from workflows.events import Event, StartEvent, StopEvent
from workflows.resource import (
Resource,
ResourceConfig,
... | "string" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/client/test_client.py | test_is_healthy | assert | string_literal | 33 | import httpx
import pytest
from httpx import ASGITransport, AsyncClient
from workflows.client import WorkflowClient
from workflows.protocol.serializable_events import EventEnvelopeWithMetadata
from workflows.server.memory_workflow_store import MemoryWorkflowStore
from workflows.server.server import WorkflowServer
from... | "healthy" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/client/test_client.py | test_cancel_handler | assert | string_literal | 45 | import httpx
import pytest
from httpx import ASGITransport, AsyncClient
from workflows.client import WorkflowClient
from workflows.protocol.serializable_events import EventEnvelopeWithMetadata
from workflows.server.memory_workflow_store import MemoryWorkflowStore
from workflows.server.server import WorkflowServer
from... | "deleted" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/server/test_main.py | test_workflow_server_with_custom_name | assert | string_literal | 29 | import os
from pathlib import Path
from typing import Any
from unittest.mock import patch
import pytest
from workflows.server.__main__ import run_server
def test_workflow_server_with_custom_name(tmp_path: Path) -> None:
"""Test that the script finds WorkflowServer instance with any variable name."""
# Create ... | "0.0.0.0" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/server/test_server_persistence.py | test_store_is_updated_on_step_completion | assert | string_literal | 66 | import asyncio
from typing import AsyncGenerator
import pytest
from httpx import ASGITransport, AsyncClient
from workflows import Context
from workflows.events import Event, InternalDispatchEvent, StopEvent
from workflows.server import WorkflowServer
from workflows.server.abstract_workflow_store import HandlerQuery, P... | "running" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/server/test_sqlite_workflow_store.py | test_update_and_query_returns_inserted_handler | assert | string_literal | 32 | from pathlib import Path
import pytest
from workflows.events import StopEvent
from workflows.server.abstract_workflow_store import HandlerQuery, PersistentHandler
from workflows.server.sqlite.sqlite_workflow_store import SqliteWorkflowStore
@pytest.mark.asyncio
async def test_update_and_query_returns_inserted_handler... | "running" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/client/test_client.py | test_get_handler | assert | string_literal | 40 | import httpx
import pytest
from httpx import ASGITransport, AsyncClient
from workflows.client import WorkflowClient
from workflows.protocol.serializable_events import EventEnvelopeWithMetadata
from workflows.server.memory_workflow_store import MemoryWorkflowStore
from workflows.server.server import WorkflowServer
from... | "greeting" | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-utils-workflow/tests/test_drawing.py | test_pyvis_resource_nodes_rendered | assert | none_literal | 42 | from unittest.mock import MagicMock, mock_open, patch
import pytest
from llama_index.utils.workflow import (
draw_all_possible_flows,
draw_all_possible_flows_mermaid,
draw_most_recent_execution,
draw_most_recent_execution_mermaid,
)
from workflows.workflow import Workflow
def test_pyvis_resource_nodes... | None | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/src/workflows/testing/runner.py | run | assert | none_literal | 55 | from collections import Counter
from dataclasses import dataclass
from typing import Any, Optional
from workflows import Context, Workflow
from workflows.events import Event, EventType, StartEvent
class WorkflowTestRunner:
def __init__(
self,
workflow: "Workflow",
):
self._workflow = ... | None | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/client/test_client.py | test_get_result_for_handler | assert | none_literal | 41 | import httpx
import pytest
from httpx import ASGITransport, AsyncClient
from workflows.client import WorkflowClient
from workflows.protocol.serializable_events import EventEnvelopeWithMetadata
from workflows.server.memory_workflow_store import MemoryWorkflowStore
from workflows.server.server import WorkflowServer
from... | None | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/context/test_context.py | test_collect_events_with_extra_event_type | assert | none_literal | 83 | from __future__ import annotations
import asyncio
from typing import Optional, Union
import pytest
from pydantic import BaseModel
from workflows.context import Context
from workflows.context.state_store import DictState
from workflows.decorators import step
from workflows.errors import WorkflowRuntimeError
from workf... | None | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/protocol/test_serializable_events.py | test_envelope_user_defined_event | assert | none_literal | 26 | import json
import pytest
from workflows.events import (
Event,
StepState,
StepStateChanged,
StopEvent,
)
from workflows.protocol.serializable_events import (
EventEnvelope,
EventEnvelopeWithMetadata,
EventValidationError,
)
def test_envelope_user_defined_event() -> None:
class MyEvent... | None | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/runtime/test_control_loop.py | test_control_loop_timeout | assert | none_literal | 123 | import asyncio
import time
import uuid
from typing import Coroutine, Optional, Union
import pytest
import time_machine
from workflows.context import Context
from workflows.decorators import step
from workflows.errors import WorkflowCancelledByUser, WorkflowTimeoutError
from workflows.events import (
Event,
Hum... | None | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/runtime/test_identity_weak_ref.py | test_identity_weak_key_dict_removes_entry_when_object_unreferenced | assert | none_literal | 31 | from __future__ import annotations
import gc
import weakref
import pytest
from workflows.runtime.types._identity_weak_ref import IdentityWeakKeyDict
def test_identity_weak_key_dict_removes_entry_when_object_unreferenced() -> None:
with pytest.raises(TypeError):
hash(Unhashable())
d: IdentityWeakKeyD... | None | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/server/test_idle_release.py | get_handler_in_memory | assert | none_literal | 23 | import asyncio
from datetime import datetime, timedelta, timezone
from typing import Any, Optional
import pytest
import time_machine
from httpx import ASGITransport, AsyncClient
from workflows import Context, Workflow, step
from workflows.events import HumanResponseEvent, StartEvent, StopEvent
from workflows.server.ab... | None | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/server/test_idle_release_live_http.py | handler_completed | assert | none_literal | 21 | from __future__ import annotations
from datetime import timedelta
import pytest
from workflows import Context, Workflow, step
from workflows.client.client import WorkflowClient
from workflows.events import Event, StartEvent, StopEvent, WorkflowIdleEvent
from workflows.server import WorkflowServer
from workflows.serve... | None | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/server/test_server_live_http.py | test_streaming_over_real_http | assert | none_literal | 63 | from __future__ import annotations
import asyncio
import contextlib
from typing import AsyncGenerator
import pytest
from workflows import Workflow
from workflows.client.client import WorkflowClient
from workflows.events import StopEvent
from workflows.server import WorkflowServer
from .conftest import ( # type: ign... | None | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/server/test_server_persistence.py | test_store_is_updated_on_step_completion | assert | none_literal | 72 | import asyncio
from typing import AsyncGenerator
import pytest
from httpx import ASGITransport, AsyncClient
from workflows import Context
from workflows.events import Event, InternalDispatchEvent, StopEvent
from workflows.server import WorkflowServer
from workflows.server.abstract_workflow_store import HandlerQuery, P... | None | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/test_resources.py | test_resource_config_init | assert | none_literal | 37 | import json
from pathlib import Path
from typing import Annotated, Optional
from unittest import mock
import pytest
from pydantic import BaseModel, Field
from workflows.decorators import step
from workflows.events import Event, StartEvent, StopEvent
from workflows.resource import (
Resource,
ResourceConfig,
... | None | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/runtime/test_identity_weak_ref.py | test_identity_weak_key_dict_removes_entry_when_object_unreferenced | assert | collection | 32 | from __future__ import annotations
import gc
import weakref
import pytest
from workflows.runtime.types._identity_weak_ref import IdentityWeakKeyDict
def test_identity_weak_key_dict_removes_entry_when_object_unreferenced() -> None:
with pytest.raises(TypeError):
hash(Unhashable())
d: IdentityWeakKeyD... | {} | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/server/test_memory_workflow_store.py | test_update_on_conflict_overwrites_existing_row | assert | collection | 37 | from datetime import datetime, timezone
import pytest
from workflows.events import StopEvent
from workflows.server.abstract_workflow_store import HandlerQuery, PersistentHandler
from workflows.server.memory_workflow_store import MemoryWorkflowStore
@pytest.mark.asyncio
async def test_update_on_conflict_overwrites_exi... | [] | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/server/test_server.py | test_init | assert | collection | 13 | from typing import Any
from unittest.mock import AsyncMock, Mock, patch
import pytest
from starlette.middleware import Middleware
from workflows.server import WorkflowServer
from workflows.workflow import Workflow
def test_init() -> None:
server = WorkflowServer()
assert len(server._middleware) == 1
asse... | {} | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/server/test_server_endpoints.py | test_delete_persisted_handler_removes_from_store | assert | collection | 100 | from __future__ import annotations
import asyncio
import json
from collections import Counter
from contextlib import asynccontextmanager
from datetime import datetime
from types import SimpleNamespace
from typing import Any, AsyncGenerator, AsyncIterator
import pytest
import pytest_asyncio
from httpx import ASGITrans... | [] | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/server/test_sqlite_workflow_store.py | test_update_on_conflict_overwrites_existing_row | assert | collection | 38 | from pathlib import Path
import pytest
from workflows.events import StopEvent
from workflows.server.abstract_workflow_store import HandlerQuery, PersistentHandler
from workflows.server.sqlite.sqlite_workflow_store import SqliteWorkflowStore
@pytest.mark.asyncio
async def test_update_on_conflict_overwrites_existing_ro... | [] | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/test_event.py | test_workflow_timed_out_event_empty_active_steps | assert | collection | 19 | from typing import Any, cast
import pytest
from pydantic import PrivateAttr
from workflows.context import JsonSerializer
from workflows.events import (
Event,
StopEvent,
WorkflowCancelledEvent,
WorkflowFailedEvent,
WorkflowTimedOutEvent,
)
def test_workflow_timed_out_event_empty_active_steps() -> ... | [] | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/test_event.py | test_workflow_cancelled_event_serialization | assert | collection | 19 | from typing import Any, cast
import pytest
from pydantic import PrivateAttr
from workflows.context import JsonSerializer
from workflows.events import (
Event,
StopEvent,
WorkflowCancelledEvent,
WorkflowFailedEvent,
WorkflowTimedOutEvent,
)
def test_workflow_cancelled_event_serialization() -> None:... | {} | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/test_utils.py | test_get_return_types | assert | collection | 29 | import inspect
from typing import Any, List, Optional, Union, get_type_hints
import pytest
from workflows.context import Context
from workflows.decorators import step
from workflows.errors import WorkflowValidationError
from workflows.events import StartEvent, StopEvent
from workflows.utils import (
_get_param_typ... | [str] | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/test_decorator.py | test_decorated_config | assert | collection | 16 | import re
import pytest
from workflows.decorators import step
from workflows.errors import WorkflowValidationError
from workflows.events import Event, StartEvent, StopEvent
from workflows.workflow import Workflow
def test_decorated_config(workflow: Workflow) -> None:
def f(self, ev: Event) -> Event: # type: igno... | [Event] | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/runtime/test_control_loop.py | test_control_loop_timeout | assert | collection | 130 | import asyncio
import time
import uuid
from typing import Coroutine, Optional, Union
import pytest
import time_machine
from workflows.context import Context
from workflows.decorators import step
from workflows.errors import WorkflowCancelledByUser, WorkflowTimeoutError
from workflows.events import (
Event,
Hum... | ["slow"] | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/test_decorator.py | test_decorate_free_function | assert | collection | 18 | import re
import pytest
from workflows.decorators import step
from workflows.errors import WorkflowValidationError
from workflows.events import Event, StartEvent, StopEvent
from workflows.workflow import Workflow
def test_decorate_free_function() -> None:
class TestWorkflow(Workflow):
pass
@step(work... | {"f": f} | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/test_resources.py | test_resource_config_init | assert | collection | 59 | import json
from pathlib import Path
from typing import Annotated, Optional
from unittest import mock
import pytest
from pydantic import BaseModel, Field
from workflows.decorators import step
from workflows.events import Event, StartEvent, StopEvent
from workflows.resource import (
Resource,
ResourceConfig,
... | ["hello"] | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/context/test_context.py | test_collect_events | assert | collection | 54 | from __future__ import annotations
import asyncio
from typing import Optional, Union
import pytest
from pydantic import BaseModel
from workflows.context import Context
from workflows.context.state_store import DictState
from workflows.decorators import step
from workflows.errors import WorkflowRuntimeError
from workf... | [ev1, ev2] | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/test_resources.py | test_resource_config_path_selector | assert | collection | 49 | import json
from pathlib import Path
from typing import Annotated, Optional
from unittest import mock
import pytest
from pydantic import BaseModel, Field
from workflows.decorators import step
from workflows.events import Event, StartEvent, StopEvent
from workflows.resource import (
Resource,
ResourceConfig,
... | ["hello/"] | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/test_utils.py | test_get_param_types_union | assert | collection | 33 | import inspect
from typing import Any, List, Optional, Union, get_type_hints
import pytest
from workflows.context import Context
from workflows.decorators import step
from workflows.errors import WorkflowValidationError
from workflows.events import StartEvent, StopEvent
from workflows.utils import (
_get_param_typ... | [str, int] | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/server/test_sqlite_workflow_store.py | test_delete_filters_by_query | assert | collection | 36 | from pathlib import Path
import pytest
from workflows.events import StopEvent
from workflows.server.abstract_workflow_store import HandlerQuery, PersistentHandler
from workflows.server.sqlite.sqlite_workflow_store import SqliteWorkflowStore
@pytest.mark.asyncio
async def test_delete_filters_by_query(tmp_path: Path) -... | {"keep-me"} | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/server/test_server.py | test_serve | assert_* | complex_expr | 20 | from typing import Any
from unittest.mock import AsyncMock, Mock, patch
import pytest
from starlette.middleware import Middleware
from workflows.server import WorkflowServer
from workflows.workflow import Workflow
@pytest.mark.asyncio
@patch("workflows.server.server.uvicorn.Server")
@patch("workflows.server.server.uv... | server.app) | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/test_resources.py | test_function_resource_init | assert | complex_expr | 31 | import json
from pathlib import Path
from typing import Annotated, Optional
from unittest import mock
import pytest
from pydantic import BaseModel, Field
from workflows.decorators import step
from workflows.events import Event, StartEvent, StopEvent
from workflows.resource import (
Resource,
ResourceConfig,
... | retval.name | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/server/test_main.py | test_no_file_path_argument | assert | complex_expr | 19 | import os
from pathlib import Path
from typing import Any
from unittest.mock import patch
import pytest
from workflows.server.__main__ import run_server
def test_no_file_path_argument(capsys: Any) -> None:
"""Test that the script exits with usage message when no file path is provided."""
with patch("sys.argv"... | captured.err | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/server/test_server.py | test_add_workflow | assert | complex_expr | 13 | from typing import Any
from unittest.mock import AsyncMock, Mock, patch
import pytest
from starlette.middleware import Middleware
from workflows.server import WorkflowServer
from workflows.workflow import Workflow
def test_add_workflow(simple_test_workflow: Workflow) -> None:
server = WorkflowServer()
server.... | server._workflows | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/server/test_server.py | test_extract_workflow_missing_name | assert | complex_expr | 18 | from typing import Any
from unittest.mock import AsyncMock, Mock, patch
import pytest
from starlette.middleware import Middleware
from workflows.server import WorkflowServer
from workflows.workflow import Workflow
def test_extract_workflow_missing_name() -> None:
server = WorkflowServer()
mock_request = Mock(... | exc_info.value.detail | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/server/test_keyed_lock.py | test_cancellation_cleanup | pytest.raises | complex_expr | 25 | from __future__ import annotations
import asyncio
import pytest
from workflows.server.keyed_lock import KeyedLock
def locks() -> KeyedLock:
return KeyedLock()
async def test_cancellation_cleanup(locks: KeyedLock) -> None:
"""Test that lock is released on task cancellation."""
started = asyncio.Event()
... | asyncio.CancelledError) | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/server/test_keyed_lock.py | test_exception_in_critical_section | pytest.raises | complex_expr | 14 | from __future__ import annotations
import asyncio
import pytest
from workflows.server.keyed_lock import KeyedLock
def locks() -> KeyedLock:
return KeyedLock()
async def test_exception_in_critical_section(locks: KeyedLock) -> None:
"""Test that lock is released even if exception occurs."""
with pytest.r... | ValueError, match="test error") | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/test_streaming.py | test_task_raised | pytest.raises | complex_expr | 32 | import asyncio
from typing import AsyncGenerator
import pytest
from workflows.context import Context
from workflows.decorators import step
from workflows.errors import WorkflowRuntimeError, WorkflowTimeoutError
from workflows.events import Event, StartEvent, StopEvent
from workflows.testing import WorkflowTestRunner
f... | ValueError, match="The step raised an error!") | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/test_streaming.py | test_task_timeout | pytest.raises | complex_expr | 33 | import asyncio
from typing import AsyncGenerator
import pytest
from workflows.context import Context
from workflows.decorators import step
from workflows.errors import WorkflowRuntimeError, WorkflowTimeoutError
from workflows.events import Event, StartEvent, StopEvent
from workflows.testing import WorkflowTestRunner
f... | WorkflowTimeoutError, match="Operation timed out") | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/test_utils.py | test_inspect_signature_raises_if_not_callable | pytest.raises | complex_expr | 26 | import inspect
from typing import Any, List, Optional, Union, get_type_hints
import pytest
from workflows.context import Context
from workflows.decorators import step
from workflows.errors import WorkflowValidationError
from workflows.events import StartEvent, StopEvent
from workflows.utils import (
_get_param_typ... | TypeError, match="Expected a callable object, got str") | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/context/test_utils.py | test_import_module_from_qualified_name_wrong_name | pytest.raises | complex_expr | 9 | import pytest
from workflows.context.utils import (
get_qualified_name,
import_module_from_qualified_name,
)
def test_import_module_from_qualified_name_wrong_name() -> None:
with | ValueError, match="Qualified name must be in format 'module.attribute'") | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/test_decorator.py | test_decorate_free_function_wrong_num_workers | pytest.raises | complex_expr | 14 | import re
import pytest
from workflows.decorators import step
from workflows.errors import WorkflowValidationError
from workflows.events import Event, StartEvent, StopEvent
from workflows.workflow import Workflow
def test_decorate_free_function_wrong_num_workers() -> None:
class TestWorkflow(Workflow):
pa... | WorkflowValidationError, match="num_workers must be an integer greater than 0") | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/test_utils.py | test_validate_step_signature_no_params | pytest.raises | complex_expr | 29 | import inspect
from typing import Any, List, Optional, Union, get_type_hints
import pytest
from workflows.context import Context
from workflows.decorators import step
from workflows.errors import WorkflowValidationError
from workflows.events import StartEvent, StopEvent
from workflows.utils import (
_get_param_typ... | WorkflowValidationError, match="Step signature must have at least one parameter") | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/context/test_utils.py | test_import_module_from_qualified_name_wrong_package | pytest.raises | complex_expr | 9 | import pytest
from workflows.context.utils import (
get_qualified_name,
import_module_from_qualified_name,
)
def test_import_module_from_qualified_name_wrong_package() -> None:
with | ImportError, match="Failed to import module __doesnt: No module named '__doesnt'") | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/protocol/test_serializable_events.py | test_parse_invalid_inputs_raise | assert | func_call | 20 | import json
import pytest
from workflows.events import (
Event,
StepState,
StepStateChanged,
StopEvent,
)
from workflows.protocol.serializable_events import (
EventEnvelope,
EventEnvelopeWithMetadata,
EventValidationError,
)
def test_parse_invalid_inputs_raise() -> None:
with pytest.ra... | str(e) | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/test_nanoid.py | test_nanoid_uniqueness | assert | func_call | 12 | from workflows.utils import _nanoid as nanoid
def test_nanoid_uniqueness() -> None:
"""Test that nanoid generates unique IDs."""
# Generate multiple IDs and check for uniqueness
ids = [nanoid() for _ in range(1000)]
unique_ids = set(ids)
# Should be very unlikely to have duplicates with 10-char al... | len(unique_ids) | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/test_workflow_typed_state.py | test_typed_state | assert | func_call | 22 | import asyncio
from typing import Optional, Union
import pytest
from pydantic import BaseModel, Field
from workflows import Context, Workflow
from workflows.decorators import step
from workflows.events import Event, StartEvent, StopEvent
from workflows.testing import WorkflowTestRunner
@pytest.mark.asyncio
async def ... | MyState(name="John", age=31).model_dump() | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/test_testing_utils.py | test_testing_utils | assert | func_call | 21 | import pytest
from workflows import Context, Workflow, step
from workflows.events import (
Event,
StartEvent,
StepStateChanged,
StopEvent,
)
from workflows.testing import WorkflowTestRunner
from workflows.testing.runner import WorkflowTestResult
@pytest.mark.asyncio
async def test_testing_utils() -> No... | sum( [wf_test_run.event_types[k] for k in wf_test_run.event_types] ) | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/test_utils.py | test_is_free_function | assert | bool_literal | 26 | import inspect
from typing import Any, List, Optional, Union, get_type_hints
import pytest
from workflows.context import Context
from workflows.decorators import step
from workflows.errors import WorkflowValidationError
from workflows.events import StartEvent, StopEvent
from workflows.utils import (
_get_param_typ... | True | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/workflows-dev/tests/test_workflows_dev_cli.py | test_is_published_returns_true_when_version_exists | assert | bool_literal | 58 | from __future__ import annotations
import json
import subprocess
from pathlib import Path
from unittest.mock import Mock, patch
from urllib.error import HTTPError
from click.testing import CliRunner
from workflows_dev.changesets import (
PackageJson,
PyProjectContainer,
current_version,
is_published,
... | True | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
run-llama/workflows-py | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | train | train | packages/llama-index-workflows/tests/test_utils.py | test_is_free_function | assert | bool_literal | 27 | import inspect
from typing import Any, List, Optional, Union, get_type_hints
import pytest
from workflows.context import Context
from workflows.decorators import step
from workflows.errors import WorkflowValidationError
from workflows.events import StartEvent, StopEvent
from workflows.utils import (
_get_param_typ... | False | 7a85c96d684d59bf871056f3dbc6329ec71f95f2 | 80 | v2_extractor_at_anchor |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.