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 |
|---|---|---|---|---|---|---|---|---|---|
zhongyu09/openchatbi | from unittest.mock import MagicMock, patch
import pytest
import yaml
from openchatbi.config_loader import Config, ConfigLoader
class TestConfigLoader:
def test_load_config_with_llm_providers_selected_by_default_llm(self, temp_dir):
"""Test loading configuration using llm_providers with default_llm provi... | "openai" | assert | string_literal | tests/test_config_loader.py | test_load_config_with_llm_providers_selected_by_default_llm | TestConfigLoader | 273 | null |
zhongyu09/openchatbi | from unittest.mock import MagicMock, patch
import pytest
import yaml
from openchatbi.config_loader import Config, ConfigLoader
class TestConfigLoader:
def test_config_initialization(self):
"""Test Config model initialization."""
from unittest.mock import MagicMock
mock_llm = MagicMock()... | "presto" | assert | string_literal | tests/test_config_loader.py | test_config_initialization | TestConfigLoader | 23 | null |
zhongyu09/openchatbi | import plotly.graph_objects as go
import pytest
from sample_ui.plotly_utils import (
create_empty_chart,
create_plotly_chart,
visualization_dsl_to_gradio_plot,
)
def sample_csv_data():
"""Sample CSV data for testing."""
return """product,sales,region,month
Widget A,10000,North,Jan
Widget B,15000,S... | "Sales Over Time" | assert | string_literal | tests/test_plotly_utils.py | test_create_line_chart_success | TestPlotlyChartCreation | 67 | null |
zhongyu09/openchatbi | from unittest.mock import Mock, patch
import pytest
from openchatbi.catalog.catalog_loader import DataCatalogLoader, load_catalog_from_data_warehouse
class TestDataCatalogLoader:
def mock_engine(self):
"""Mock SQLAlchemy engine."""
engine = Mock()
return engine
def test_get_table_in... | "idx_test" | assert | string_literal | tests/test_catalog_loader.py | test_get_table_indexes | TestDataCatalogLoader | 64 | null |
zhongyu09/openchatbi | from unittest.mock import patch
import pytest
from openchatbi.tool.search_knowledge import search_knowledge, show_schema
class TestSearchKnowledge:
def test_show_schema_basic(self):
"""Test basic schema display functionality."""
reasoning = "Showing basic schema"
tables = ["user_data"]
... | tables) | assert_* | variable | tests/test_tools_search_knowledge.py | test_show_schema_basic | TestSearchKnowledge | 220 | null |
zhongyu09/openchatbi | from unittest.mock import Mock, patch
import pytest
from openchatbi.catalog.catalog_loader import DataCatalogLoader, load_catalog_from_data_warehouse
class TestDataCatalogLoader:
def mock_engine(self):
"""Mock SQLAlchemy engine."""
engine = Mock()
return engine
def test_error_handli... | {} | assert | collection | tests/test_catalog_loader.py | test_error_handling_in_get_tables_and_columns | TestDataCatalogLoader | 147 | null |
zhongyu09/openchatbi | from unittest.mock import Mock, patch
import pytest
from langchain_core.messages import AIMessage, HumanMessage, SystemMessage, ToolMessage
from openchatbi.context_config import ContextConfig
from openchatbi.context_manager import ContextManager
class TestContextManager:
def mock_llm(self):
"""Mock LLM ... | [] | assert | collection | tests/context_management/test_context_manager.py | test_manage_context_empty_messages | TestContextManager | 201 | null |
zhongyu09/openchatbi | import pytest
from openchatbi.text2sql.visualization import ChartType, VisualizationConfig, VisualizationDSL, VisualizationService
def sample_csv_data():
"""Fixture providing sample CSV data for testing."""
return """product,sales,region,quarter
Widget A,10000,North,Q1
Widget B,15000,South,Q1
Widget C,8000,Ea... | 2 | assert | numeric_literal | tests/test_text2sql_visualization.py | test_complete_workflow_bar_chart | TestVisualizationIntegration | 338 | null |
zhongyu09/openchatbi | from unittest.mock import Mock, patch
import pytest
from langchain_core.messages import AIMessage, HumanMessage, ToolMessage
from openchatbi.context_config import ContextConfig
from openchatbi.context_manager import ContextManager
class TestContextManagementEdgeCases:
def edge_case_config(self):
"""Conf... | str(e).lower() | assert | func_call | tests/context_management/test_edge_cases.py | test_malformed_messages | TestContextManagementEdgeCases | 57 | null |
zhongyu09/openchatbi | from unittest.mock import MagicMock, patch
import pytest
import yaml
from openchatbi.config_loader import Config, ConfigLoader
class TestConfigLoader:
def test_config_initialization(self):
"""Test Config model initialization."""
from unittest.mock import MagicMock
mock_llm = MagicMock()... | mock_llm | assert | variable | tests/test_config_loader.py | test_config_initialization | TestConfigLoader | 24 | null |
zhongyu09/openchatbi | import json
from datetime import date
from unittest.mock import Mock, patch
from langchain_core.messages import AIMessage, HumanMessage
from openchatbi.graph_state import SQLGraphState
from openchatbi.text2sql.extraction import (
generate_extraction_prompt,
information_extraction,
information_extraction_c... | "end" | assert | string_literal | tests/test_text2sql_extraction.py | test_information_extraction_conditional_edges_failure | TestText2SQLExtraction | 141 | null |
zhongyu09/openchatbi | from pathlib import Path
from unittest.mock import AsyncMock, Mock, patch
import pytest
from langchain_core.language_models import FakeListChatModel
from langchain_openai import ChatOpenAI
pysqlite3 = pytest.importorskip("pysqlite3", reason="pysqlite3 not available")
from openchatbi.tool.memory import (
Structur... | "UTC" | assert | string_literal | tests/test_memory.py | test_user_profile_basic_initialization | TestUserProfile | 36 | null |
zhongyu09/openchatbi | from unittest.mock import Mock, patch
import pytest
from langchain_core.messages import AIMessage, HumanMessage, ToolMessage
from openchatbi.context_config import ContextConfig
from openchatbi.context_manager import ContextManager
class TestContextManagementEdgeCases:
def edge_case_config(self):
"""Conf... | [] | assert | collection | tests/context_management/test_edge_cases.py | test_empty_and_none_inputs | TestContextManagementEdgeCases | 35 | null |
zhongyu09/openchatbi | from unittest.mock import Mock, patch
import pytest
from langchain_core.messages import AIMessage
from openchatbi.graph_state import SQLGraphState
from openchatbi.text2sql.generate_sql import create_sql_nodes, should_execute_sql, should_retry_sql
class TestText2SQLGenerateSQL:
def mock_llm(self):
"""Moc... | "end" | assert | string_literal | tests/test_text2sql_generate_sql.py | test_should_retry_sql_success | TestText2SQLGenerateSQL | 194 | null |
zhongyu09/openchatbi | from unittest.mock import Mock, patch
import pytest
from openchatbi.catalog.catalog_loader import DataCatalogLoader, load_catalog_from_data_warehouse
class TestDataCatalogLoader:
def mock_engine(self):
"""Mock SQLAlchemy engine."""
engine = Mock()
return engine
def test_save_to_cata... | True | assert | bool_literal | tests/test_catalog_loader.py | test_save_to_catalog_store_success | TestDataCatalogLoader | 98 | null |
zhongyu09/openchatbi | import pytest
from pydantic import ValidationError
from openchatbi.tool.ask_human import AskHuman
class TestAskHuman:
def test_ask_human_basic_initialization(self):
"""Test basic AskHuman model creation."""
question = "What time period should I analyze?"
options = ["Last 7 days", "Last 30... | options | assert | variable | tests/test_tools_ask_human.py | test_ask_human_basic_initialization | TestAskHuman | 20 | null |
zhongyu09/openchatbi | from unittest.mock import patch
from openchatbi.tool.run_python_code import run_python_code
class TestRunPythonCode:
def test_run_python_code_basic(self):
"""Test basic Python code execution."""
reasoning = "Testing basic print functionality"
code = "print('Hello, World!')"
with ... | result | assert | variable | tests/test_tools_run_python_code.py | test_run_python_code_basic | TestRunPythonCode | 23 | null |
zhongyu09/openchatbi | from unittest.mock import Mock
from langchain_core.messages import AIMessage, HumanMessage, ToolMessage
from openchatbi.agent_graph import agent_llm_call
from openchatbi.graph_state import AgentState
from openchatbi.utils import recover_incomplete_tool_calls
class TestIncompleteToolCallRecovery:
def test_incomp... | "call_1" | assert | string_literal | tests/test_incomplete_tool_calls.py | test_incomplete_single_tool_call | TestIncompleteToolCallRecovery | 58 | null |
zhongyu09/openchatbi | from langchain_core.messages import AIMessage, HumanMessage, ToolMessage
from openchatbi.graph_state import AgentState, InputState, OutputState
class TestAgentState:
def test_agent_state_immutability(self):
"""Test that AgentState behaves correctly with updates."""
original_state = AgentState(
... | 2 | assert | numeric_literal | tests/test_graph_state.py | test_agent_state_immutability | TestAgentState | 62 | null |
zhongyu09/openchatbi | import io
from unittest.mock import patch
import pytest
from openchatbi.utils import log
class TestUtilityFunctions:
def test_log_function_unicode_handling(self):
"""Test logging with unicode characters."""
unicode_message = "Test with émojis: 🚀 and spéciál characters: ñáéíóú"
captured... | 0 | assert | numeric_literal | tests/test_utils.py | test_log_function_unicode_handling | TestUtilityFunctions | 108 | null |
zhongyu09/openchatbi | import plotly.graph_objects as go
import pytest
from sample_ui.plotly_utils import (
create_empty_chart,
create_plotly_chart,
visualization_dsl_to_gradio_plot,
)
def sample_csv_data():
"""Sample CSV data for testing."""
return """product,sales,region,month
Widget A,10000,North,Jan
Widget B,15000,S... | description | assert | variable | tests/test_plotly_utils.py | test_successful_conversion | TestVisualizationDslToGradioPlot | 240 | null |
askui/python-sdk | import pathlib
import sys
from unittest.mock import patch
import pytest
from pydantic import ValidationError
from askui.tools.askui.askui_controller_settings import AskUiControllerSettings
class TestAskUiControllerSettings:
def test_controller_path_setting_takes_precedence(
self, tmp_path: pathlib.Path
... | controller_path | assert | variable | tests/unit/tools/askui/test_askui_controller_settings.py | test_controller_path_setting_takes_precedence | TestAskUiControllerSettings | 25 | null |
askui/python-sdk | import pathlib
import sys
from unittest.mock import patch
import pytest
from pydantic import ValidationError
from askui.tools.askui.askui_controller_settings import AskUiControllerSettings
class TestAskUiControllerSettings:
def test_controller_path_cached_property(self, tmp_path: pathlib.Path) -> None:
... | second_result | assert | variable | tests/unit/tools/askui/test_askui_controller_settings.py | test_controller_path_cached_property | TestAskUiControllerSettings | 245 | null |
askui/python-sdk | import base64
import pathlib
import pytest
from PIL import Image
from askui.utils.image_utils import (
ImageSource,
ScalingResults,
base64_to_image,
data_url_to_image,
draw_point_on_image,
image_to_base64,
image_to_data_url,
scale_coordinates,
scale_image_to_fit,
)
class TestBase6... | jpeg_base64 | assert | variable | tests/unit/utils/test_image_utils.py | test_image_to_base64_format | TestBase64Conversion | 146 | null |
askui/python-sdk | from pathlib import Path
import pytest
from askui.tools.testing.feature_models import Feature
from askui.tools.testing.scenario_models import (
ScenarioCreateParams,
ScenarioExample,
ScenarioListQuery,
ScenarioModifyParams,
ScenarioStep,
)
from askui.tools.testing.scenario_tools import (
Creat... | "步骤" | assert | string_literal | tests/integration/tools/testing/test_scenario_tools.py | test_create_scenario_unicode | 109 | null | |
askui/python-sdk | import json
import tempfile
from pathlib import Path
from typing import Any
from askui.models.shared.agent_message_param import MessageParam, ToolUseBlockParam
from askui.models.shared.agent_on_message_cb import OnMessageCbParam
from askui.utils.cache_writer import CacheWriter
def test_cache_writer_detects_cached_exe... | True | assert | bool_literal | tests/unit/utils/test_cache_writer.py | test_cache_writer_detects_cached_execution | 137 | null | |
askui/python-sdk | from typing import Any
import pytest
from askui.telemetry import InMemoryProcessor, Telemetry, TelemetrySettings
def test_telemetry_disabled() -> None:
settings = TelemetrySettings(enabled=False)
telemetry = Telemetry(settings)
processor = InMemoryProcessor()
telemetry.add_processor(processor)
@... | 0 | assert | numeric_literal | tests/unit/telemetry/test_telemetry.py | test_telemetry_disabled | 20 | null | |
askui/python-sdk | from pathlib import Path
import pytest
from askui.tools.testing.execution_models import (
Execution,
ExecutionCreateParams,
ExecutionListQuery,
ExecutionModifyParams,
ExecutionStatus,
ExecutionStep,
)
from askui.tools.testing.execution_tools import (
CreateExecutionTool,
DeleteExecutio... | exec_dict | assert | variable | tests/integration/tools/testing/test_execution_tools.py | test_retrieve_execution | 110 | null | |
askui/python-sdk | from pathlib import Path
import pytest
from askui.tools.testing.feature_models import Feature
from askui.tools.testing.scenario_models import (
ScenarioCreateParams,
ScenarioExample,
ScenarioListQuery,
ScenarioModifyParams,
ScenarioStep,
)
from askui.tools.testing.scenario_tools import (
Creat... | ValueError) | pytest.raises | variable | tests/integration/tools/testing/test_scenario_tools.py | test_retrieve_invalid_id | 162 | null | |
askui/python-sdk | import pathlib
from typing import Literal, Type
import pytest
from PIL import Image as PILImage
from pydantic import BaseModel, RootModel
from pytest_mock import MockerFixture
from typing_extensions import override
from askui import AgentSettings, ComputerAgent, ResponseSchemaBase
from askui.model_providers.image_qa_... | response.url | assert | complex_expr | tests/e2e/agent/test_get.py | test_get_with_response_schema_with_default_value | 378 | null | |
askui/python-sdk | from pathlib import Path
import pytest
from askui.tools.testing.feature_models import (
FeatureCreateParams,
FeatureListQuery,
FeatureModifyParams,
)
from askui.tools.testing.feature_tools import (
CreateFeatureTool,
DeleteFeatureTool,
ListFeatureTool,
ModifyFeatureTool,
RetrieveFeatur... | [] | assert | collection | tests/integration/tools/testing/test_feature_tools.py | test_create_feature_minimal | 70 | null | |
askui/python-sdk | from pathlib import Path
import pytest
from askui.tools.testing.feature_models import Feature
from askui.tools.testing.scenario_models import (
ScenarioCreateParams,
ScenarioExample,
ScenarioListQuery,
ScenarioModifyParams,
ScenarioStep,
)
from askui.tools.testing.scenario_tools import (
Creat... | params.name | assert | complex_expr | tests/integration/tools/testing/test_scenario_tools.py | test_create_scenario_minimal | 95 | null | |
askui/python-sdk | import json
from typing import Any
from unittest.mock import Mock
import pytest
from askui.models.exceptions import QueryNoResponseError
from askui.models.openrouter.get_model import OpenRouterModel
from askui.models.shared.settings import GetSettings
from askui.models.types.response_schemas import ResponseSchemaBase... | "Test text" | assert | string_literal | tests/integration/models/openrouter/test_openrouter.py | test_query_with_response_schema_returns_validated_object | 74 | null | |
askui/python-sdk | import re
import pytest
from PIL import Image as PILImage
from askui.locators import Element, Image, Prompt, Text
from askui.locators.relatable import CircularDependencyError
TEST_IMAGE = PILImage.new("RGB", (100, 100), color="red")
def test_text_regex_str() -> None:
text = Text("h.*o", match_type="regex")
... | 'text matching regex "h.*o"' | assert | string_literal | tests/unit/locators/serializers/test_locator_string_representation.py | test_text_regex_str | 29 | null | |
askui/python-sdk | import pathlib
import pytest
from PIL import Image as PILImage
from askui.agent import ComputerAgent
from askui.locators import Element, Image, Prompt, Text
from askui.locators.locators import AiElement
from askui.models.exceptions import ElementNotFoundError
class TestAgentLocateWithRelations:
def test_locate_... | y | assert | variable | tests/e2e/agent/test_locate_with_relations.py | test_locate_with_above_relation | TestAgentLocateWithRelations | 26 | null |
askui/python-sdk | import time
from unittest.mock import Mock
import pytest
from PIL import Image as PILImage
from pydantic import ValidationError
from askui.agent import ComputerAgent
from askui.locators import Element
from askui.models.exceptions import WaitUntilError
class TestAgentWait:
def test_wait_for_element_appear_failur... | WaitUntilError) | pytest.raises | variable | tests/e2e/agent/test_wait.py | test_wait_for_element_appear_failure | TestAgentWait | 79 | null |
askui/python-sdk | import pathlib
import sys
from unittest.mock import patch
import pytest
from pydantic import ValidationError
from askui.tools.askui.askui_controller_settings import AskUiControllerSettings
class TestAskUiControllerSettings:
def test_assertion_error_when_no_controller_found(self) -> None:
"""Test that as... | ValueError, match="No AskUI Remote Device Controller found") | pytest.raises | complex_expr | tests/unit/tools/askui/test_askui_controller_settings.py | test_assertion_error_when_no_controller_found | TestAskUiControllerSettings | 396 | null |
askui/python-sdk | from typing import TYPE_CHECKING
from unittest.mock import Mock
from PIL import Image as PILImage
from askui.agent import ComputerAgent
from askui.locators import Element
class TestAgentOffset:
def _setup_mocks(
self, vision_agent: ComputerAgent, github_login_screenshot: PILImage.Image
) -> tuple[Mo... | 3) | assert_* | numeric_literal | tests/e2e/agent/test_agent_offset.py | test_type_with_positive_offset | TestAgentOffset | 229 | null |
askui/python-sdk | import base64
import io
from typing import Literal
import pytest
from PIL import Image
from askui.reporting import CompositeReporter
from askui.tools.agent_os import Coordinate
from askui.tools.askui.askui_controller import (
AskUiControllerClient,
AskUiControllerServer,
RenderObjectStyle,
)
from askui.to... | None | assert | none_literal | tests/e2e/tools/askui/test_askui_controller.py | test_get_display_information | 129 | null | |
askui/python-sdk | from pathlib import Path
import pytest
from askui.tools.testing.feature_models import Feature
from askui.tools.testing.scenario_models import (
ScenarioCreateParams,
ScenarioExample,
ScenarioListQuery,
ScenarioModifyParams,
ScenarioStep,
)
from askui.tools.testing.scenario_tools import (
Creat... | 1 | assert | numeric_literal | tests/integration/tools/testing/test_scenario_tools.py | test_retrieve_scenario | 153 | null | |
askui/python-sdk | from unittest.mock import patch
import pytest
from pydantic import ValidationError
from askui.tools.askui.askui_controller_client_settings import (
AskUiControllerClientSettings,
)
class TestAskUiControllerClientSettings:
def test_defaults(self) -> None:
"""Defaults are applied when no environment v... | True | assert | bool_literal | tests/unit/tools/askui/test_askui_controller_client_settings.py | test_defaults | TestAskUiControllerClientSettings | 19 | null |
askui/python-sdk | import base64
import pathlib
import pytest
from PIL import Image
from askui.utils.image_utils import (
ImageSource,
ScalingResults,
base64_to_image,
data_url_to_image,
draw_point_on_image,
image_to_base64,
image_to_data_url,
scale_coordinates,
scale_image_to_fit,
)
class TestEdgeC... | (100, 100) | assert | collection | tests/unit/utils/test_image_utils.py | test_empty_image | TestEdgeCases | 270 | null |
askui/python-sdk | import time
from unittest.mock import Mock
import pytest
from PIL import Image as PILImage
from pydantic import ValidationError
from askui.agent import ComputerAgent
from askui.locators import Element
from askui.models.exceptions import WaitUntilError
class TestAgentWait:
def test_wait_for_element_appear_succes... | 2 | assert | numeric_literal | tests/e2e/agent/test_wait.py | test_wait_for_element_appear_success | TestAgentWait | 64 | null |
askui/python-sdk | import json
import tempfile
from pathlib import Path
from typing import Any
from unittest.mock import MagicMock, patch
import pytest
from askui.models.shared.settings import CachedExecutionToolSettings
from askui.models.shared.tools import ToolCollection
from askui.tools.caching_tools import (
ExecuteCachedTrajec... | 3 | assert | numeric_literal | tests/unit/tools/test_caching_tools.py | test_execute_cached_execution_uses_delay_time_between_actions | 289 | null | |
askui/python-sdk | import pathlib
import re
import pytest
from PIL import Image as PILImage
from pytest_mock import MockerFixture
from askui.locators import Element, Image, Prompt, Text
from askui.locators.locators import Locator
from askui.locators.relatable import CircularDependencyError
from askui.locators.serializers import AskUiLo... | 5 | assert | numeric_literal | tests/unit/locators/serializers/test_askui_locator_serializer.py | test_serialize_image_with_all_options | 139 | null | |
askui/python-sdk | import pathlib
from typing import Literal, Type
import pytest
from PIL import Image as PILImage
from pydantic import BaseModel, RootModel
from pytest_mock import MockerFixture
from typing_extensions import override
from askui import AgentSettings, ComputerAgent, ResponseSchemaBase
from askui.model_providers.image_qa_... | True | assert | bool_literal | tests/e2e/agent/test_get.py | test_get_with_boolean_schema | 564 | null | |
askui/python-sdk | from pathlib import Path
import pytest
from askui.tools.testing.feature_models import Feature
from askui.tools.testing.scenario_models import (
ScenarioCreateParams,
ScenarioExample,
ScenarioListQuery,
ScenarioModifyParams,
ScenarioStep,
)
from askui.tools.testing.scenario_tools import (
Creat... | 0 | assert | numeric_literal | tests/integration/tools/testing/test_scenario_tools.py | test_list_scenarios_empty | 181 | null | |
askui/python-sdk | from askui.utils.str_utils import truncate_long_strings
def test_truncate_long_strings_with_string() -> None:
assert truncate_long_strings("short") == "short"
assert truncate_long_strings("a" * 101) == | "a" * 20 + "... [shortened]" | assert | string_literal | tests/unit/utils/test_str_utils.py | test_truncate_long_strings_with_string | 22 | null | |
askui/python-sdk | from pathlib import Path
import pytest
from askui.tools.testing.execution_models import (
Execution,
ExecutionCreateParams,
ExecutionListQuery,
ExecutionModifyParams,
ExecutionStatus,
ExecutionStep,
)
from askui.tools.testing.execution_tools import (
CreateExecutionTool,
DeleteExecutio... | len(new_steps) | assert | func_call | tests/integration/tools/testing/test_execution_tools.py | test_modify_execution_partial | 185 | null | |
askui/python-sdk | from askui.utils.str_utils import truncate_long_strings
def test_truncate_long_strings_with_empty_data() -> None:
assert truncate_long_strings({}) == {}
assert truncate_long_strings([]) == | [] | assert | collection | tests/unit/utils/test_str_utils.py | test_truncate_long_strings_with_empty_data | 52 | null | |
askui/python-sdk | import base64
import pathlib
import pytest
from PIL import Image
from askui.utils.image_utils import (
ImageSource,
ScalingResults,
base64_to_image,
data_url_to_image,
draw_point_on_image,
image_to_base64,
image_to_data_url,
scale_coordinates,
scale_image_to_fit,
)
class TestDataU... | (128, 125) | assert | collection | tests/unit/utils/test_image_utils.py | test_data_url_to_image | TestDataUrlConversion | 52 | null |
askui/python-sdk | import pathlib
import re
import pytest
from PIL import Image as PILImage
from pytest_mock import MockerFixture
from askui.locators import Element, Image, Prompt, Text
from askui.locators.locators import Locator
from askui.locators.relatable import CircularDependencyError
from askui.locators.serializers import AskUiLo... | 1 | assert | numeric_literal | tests/unit/locators/serializers/test_askui_locator_serializer.py | test_serialize_image | 105 | null | |
askui/python-sdk | import pytest
from PIL import Image as PILImage
from askui.locators import Element, Prompt, Text
from askui.locators.locators import Image, Locator
from askui.locators.relatable import CircularDependencyError
from askui.locators.serializers import VlmLocatorSerializer
TEST_IMAGE = PILImage.new("RGB", (100, 100), colo... | ValueError, match="Unsupported locator type:.*") | pytest.raises | complex_expr | tests/unit/locators/serializers/test_vlm_locator_serializer.py | test_serialize_unsupported_locator_type | 78 | null | |
askui/python-sdk | import pytest
from askui import ComputerAgent
def test_validate_call_with_invalid_reporters_type_raises_value_error() -> None:
with pytest.raises( | ValueError) | pytest.raises | variable | tests/unit/test_validate_call.py | test_validate_call_with_invalid_reporters_type_raises_value_error | 7 | null | |
askui/python-sdk | import pytest
from pydantic import ValidationError
from askui.utils.not_given import NOT_GIVEN, BaseModelWithNotGiven, NotGiven
def test_notgivenfield_json_dump() -> None:
m = DummyModel()
json_str = m.model_dump_json()
# Should not include 'value' in JSON if NOT_GIVEN
assert json_str == "{}"
m2 =... | '{"value":11}' | assert | string_literal | tests/unit/utils/test_not_given.py | test_notgivenfield_json_dump | 61 | null | |
askui/python-sdk | import re
from pathlib import Path
import pytest
from PIL import Image as PILImage
from askui.locators import AiElement, Element, Image, Prompt, Text
TEST_IMAGE_PATH = Path("tests/fixtures/images/github_com__icon.png")
class TestTextLocator:
def test_initialization_with_similarity(self) -> None:
text =... | 80 | assert | numeric_literal | tests/unit/locators/test_locators.py | test_initialization_with_similarity | TestTextLocator | 80 | null |
askui/python-sdk | from pathlib import Path
import pytest
from askui.tools.testing.execution_models import (
Execution,
ExecutionCreateParams,
ExecutionListQuery,
ExecutionModifyParams,
ExecutionStatus,
ExecutionStep,
)
from askui.tools.testing.execution_tools import (
CreateExecutionTool,
DeleteExecutio... | "测试✨" | assert | string_literal | tests/integration/tools/testing/test_execution_tools.py | test_create_execution_unicode | 85 | null | |
askui/python-sdk | import pytest
from pydantic import ValidationError
from askui.utils.not_given import NOT_GIVEN, BaseModelWithNotGiven, NotGiven
def test_notgiven_singleton() -> None:
assert NotGiven() is | NOT_GIVEN | assert | variable | tests/unit/utils/test_not_given.py | test_notgiven_singleton | 12 | null | |
askui/python-sdk | from pathlib import Path
import pytest
from askui.tools.testing.feature_models import (
FeatureCreateParams,
FeatureListQuery,
FeatureModifyParams,
)
from askui.tools.testing.feature_tools import (
CreateFeatureTool,
DeleteFeatureTool,
ListFeatureTool,
ModifyFeatureTool,
RetrieveFeatur... | params.name | assert | complex_expr | tests/integration/tools/testing/test_feature_tools.py | test_create_feature_minimal | 68 | null | |
askui/python-sdk | from datetime import datetime, timezone
from unittest.mock import patch
import pytest
from askui.utils.http_utils import parse_retry_after_header
class TestParseRetryAfterHeader:
def test_parse_numeric_seconds(self) -> None:
"""Test parsing numeric retry-after values."""
assert parse_retry_after... | 0.0 | assert | numeric_literal | tests/unit/utils/test_http_utils.py | test_parse_numeric_seconds | TestParseRetryAfterHeader | 16 | null |
askui/python-sdk | import base64
import pathlib
import pytest
from PIL import Image
from askui.utils.image_utils import (
ImageSource,
ScalingResults,
base64_to_image,
data_url_to_image,
draw_point_on_image,
image_to_base64,
image_to_data_url,
scale_coordinates,
scale_image_to_fit,
)
class TestScali... | factor | assert | variable | tests/unit/utils/test_image_utils.py | test_scaling_results | TestScalingResults | 259 | null |
askui/python-sdk | import pytest
from pydantic import ValidationError
from askui.utils.not_given import NOT_GIVEN, BaseModelWithNotGiven, NotGiven
def test_notgivenfield_json_dump() -> None:
m = DummyModel()
json_str = m.model_dump_json()
# Should not include 'value' in JSON if NOT_GIVEN
assert json_str == | "{}" | assert | string_literal | tests/unit/utils/test_not_given.py | test_notgivenfield_json_dump | 58 | null | |
askui/python-sdk | from pathlib import Path
import pytest
from askui.tools.testing.feature_models import (
FeatureCreateParams,
FeatureListQuery,
FeatureModifyParams,
)
from askui.tools.testing.feature_tools import (
CreateFeatureTool,
DeleteFeatureTool,
ListFeatureTool,
ModifyFeatureTool,
RetrieveFeatur... | long_name | assert | variable | tests/integration/tools/testing/test_feature_tools.py | test_create_feature_long_name | 85 | null | |
askui/python-sdk | import pathlib
from typing import Any, Union
import pytest
from typing_extensions import override
from askui import (
AgentSettings,
ComputerAgent,
Point,
PointList,
ResponseSchema,
ResponseSchemaBase,
)
from askui.locators.locators import Locator
from askui.model_providers.detection_provider ... | 1 | assert | numeric_literal | tests/integration/test_custom_models.py | test_inject_and_use_custom_vlm_provider | TestCustomProviders | 160 | null |
askui/python-sdk | from pathlib import Path
from askui.utils.api_utils import ListQuery, list_resource_paths
def _create_json_files(tmp_path: Path, names: list[str]) -> None:
for name in names:
(tmp_path / name).write_text("{}")
def _create_non_json_files(tmp_path: Path, names: list[str]) -> None:
for name in names:
... | [] | assert | collection | tests/integration/utils/test_api_utils.py | test_list_resource_paths_empty_dir | 18 | null | |
askui/python-sdk | from pathlib import Path
import pytest
from askui.tools.testing.execution_models import (
Execution,
ExecutionCreateParams,
ExecutionListQuery,
ExecutionModifyParams,
ExecutionStatus,
ExecutionStep,
)
from askui.tools.testing.execution_tools import (
CreateExecutionTool,
DeleteExecutio... | "passed" | assert | string_literal | tests/integration/tools/testing/test_execution_tools.py | test_modify_execution_partial | 181 | null | |
askui/python-sdk | import pytest
from pydantic import ValidationError
from askui.utils.not_given import NOT_GIVEN, BaseModelWithNotGiven, NotGiven
def test_notgivenfield_in_pydantic_model() -> None:
m1 = DummyModel()
assert m1.value is NOT_GIVEN
m2 = DummyModel(value=7)
assert m2.value == | 7 | assert | numeric_literal | tests/unit/utils/test_not_given.py | test_notgivenfield_in_pydantic_model | 41 | null | |
askui/python-sdk | import json
from typing import Any
from unittest.mock import Mock
import pytest
from askui.models.exceptions import QueryNoResponseError
from askui.models.openrouter.get_model import OpenRouterModel
from askui.models.shared.settings import GetSettings
from askui.models.types.response_schemas import ResponseSchemaBase... | 42 | assert | numeric_literal | tests/integration/models/openrouter/test_openrouter.py | test_query_with_response_schema_returns_validated_object | 75 | null | |
askui/python-sdk | import json
import tempfile
from pathlib import Path
from typing import Any
from askui.models.shared.agent_message_param import MessageParam, ToolUseBlockParam
from askui.models.shared.agent_on_message_cb import OnMessageCbParam
from askui.utils.cache_writer import CacheWriter
def test_cache_writer_generate_writes_fi... | "id1" | assert | string_literal | tests/unit/utils/test_cache_writer.py | test_cache_writer_generate_writes_file | 172 | null | |
askui/python-sdk | import pathlib
from typing import Any, Union
import pytest
from typing_extensions import override
from askui import (
AgentSettings,
ComputerAgent,
Point,
PointList,
ResponseSchema,
ResponseSchemaBase,
)
from askui.locators.locators import Locator
from askui.model_providers.detection_provider ... | None | assert | none_literal | tests/integration/test_custom_models.py | test_inject_and_use_custom_vlm_provider | TestCustomProviders | 164 | null |
askui/python-sdk | import json
import tempfile
from pathlib import Path
from typing import Any
from unittest.mock import MagicMock, patch
import pytest
from askui.models.shared.settings import CachedExecutionToolSettings
from askui.models.shared.tools import ToolCollection
from askui.tools.caching_tools import (
ExecuteCachedTrajec... | [] | assert | collection | tests/unit/tools/test_caching_tools.py | test_retrieve_cached_test_executions_returns_empty_list_when_no_files | 46 | null | |
askui/python-sdk | import uuid
from collections.abc import Generator
import machineid
import pytest
from pytest_mock import MockerFixture
from askui.telemetry.anonymous_id import get_anonymous_id
def reset_caches() -> Generator[None, None, None]:
"""Reset the module-level caches before each test."""
import askui.telemetry.anon... | test_id) | assert_* | variable | tests/unit/telemetry/test_anonymous_id.py | test_get_anonymous_id_uses_random_uuid_when_device_id_unavailable | 75 | null | |
askui/python-sdk | from datetime import datetime, timezone
from unittest.mock import patch
import pytest
from askui.utils.http_utils import parse_retry_after_header
class TestParseRetryAfterHeader:
def test_parse_empty_string(self) -> None:
"""Test parsing empty string input."""
with pytest.raises( | ValueError, match="Could not parse Retry-After header: ") | pytest.raises | complex_expr | tests/unit/utils/test_http_utils.py | test_parse_empty_string | TestParseRetryAfterHeader | 75 | null |
askui/python-sdk | import base64
import pathlib
import pytest
from PIL import Image
from askui.utils.image_utils import (
ImageSource,
ScalingResults,
base64_to_image,
data_url_to_image,
draw_point_on_image,
image_to_base64,
image_to_data_url,
scale_coordinates,
scale_image_to_fit,
)
class TestImage... | original_y | assert | variable | tests/unit/utils/test_image_utils.py | test_scale_coordinates_back | TestImageScaling | 207 | null |
askui/python-sdk | from pathlib import Path
import pytest
from askui.tools.testing.feature_models import (
FeatureCreateParams,
FeatureListQuery,
FeatureModifyParams,
)
from askui.tools.testing.feature_tools import (
CreateFeatureTool,
DeleteFeatureTool,
ListFeatureTool,
ModifyFeatureTool,
RetrieveFeatur... | ["new"] | assert | collection | tests/integration/tools/testing/test_feature_tools.py | test_modify_feature_partial | 167 | null | |
askui/python-sdk | import pytest
from PIL import Image as PILImage
from askui.agent import ComputerAgent
from askui.exceptions import AutomationError
from askui.locators import AiElement, Prompt, Text
class TestAgentLocateWithDifferentModels:
def test_locate_with_pta_model(
self,
agent_with_pta_model: ComputerAgent... | y | assert | variable | tests/e2e/agent/test_locate_with_different_models.py | test_locate_with_pta_model | TestAgentLocateWithDifferentModels | 26 | null |
askui/python-sdk | from pathlib import Path
import pytest
from askui.tools.testing.execution_models import (
Execution,
ExecutionCreateParams,
ExecutionListQuery,
ExecutionModifyParams,
ExecutionStatus,
ExecutionStep,
)
from askui.tools.testing.execution_tools import (
CreateExecutionTool,
DeleteExecutio... | "list" | assert | string_literal | tests/integration/tools/testing/test_execution_tools.py | test_list_executions_empty | 141 | null | |
askui/python-sdk | import base64
import pathlib
import pytest
from PIL import Image
from askui.utils.source_utils import load_image_source
class TestLoadImageSource:
def test_image_source_from_path(
self, path_fixtures_github_com__icon: pathlib.Path
) -> None:
# Test loading from Path
source = load_ima... | (128, 125) | assert | collection | tests/unit/utils/test_source_utils.py | test_image_source_from_path | TestLoadImageSource | 23 | null |
askui/python-sdk | from pathlib import Path
import pytest
from askui.tools.testing.feature_models import (
FeatureCreateParams,
FeatureListQuery,
FeatureModifyParams,
)
from askui.tools.testing.feature_tools import (
CreateFeatureTool,
DeleteFeatureTool,
ListFeatureTool,
ModifyFeatureTool,
RetrieveFeatur... | "描述" | assert | string_literal | tests/integration/tools/testing/test_feature_tools.py | test_create_feature_unicode | 77 | null | |
askui/python-sdk | import re
import pytest
from PIL import Image as PILImage
from askui.locators import Element, Image, Prompt, Text
from askui.locators.relatable import CircularDependencyError
TEST_IMAGE = PILImage.new("RGB", (100, 100), color="red")
def test_text_exact_str() -> None:
text = Text("hello", match_type="exact")
... | 'text "hello"' | assert | string_literal | tests/unit/locators/serializers/test_locator_string_representation.py | test_text_exact_str | 19 | null | |
askui/python-sdk | import time
from unittest.mock import Mock
import pytest
from PIL import Image as PILImage
from pydantic import ValidationError
from askui.agent import ComputerAgent
from askui.locators import Element
from askui.models.exceptions import WaitUntilError
class TestAgentWait:
def test_wait_disappear_timing(
... | 3 | assert | numeric_literal | tests/e2e/agent/test_wait.py | test_wait_disappear_timing | TestAgentWait | 197 | null |
askui/python-sdk | from pathlib import Path
import pytest
from askui.tools.testing.feature_models import (
FeatureCreateParams,
FeatureListQuery,
FeatureModifyParams,
)
from askui.tools.testing.feature_tools import (
CreateFeatureTool,
DeleteFeatureTool,
ListFeatureTool,
ModifyFeatureTool,
RetrieveFeatur... | feat_dict | assert | variable | tests/integration/tools/testing/test_feature_tools.py | test_retrieve_feature | 104 | null | |
askui/python-sdk | from pathlib import Path
import pytest
from askui.tools.testing.feature_models import Feature
from askui.tools.testing.scenario_models import (
ScenarioCreateParams,
ScenarioExample,
ScenarioListQuery,
ScenarioModifyParams,
ScenarioStep,
)
from askui.tools.testing.scenario_tools import (
Creat... | "测试✨" | assert | string_literal | tests/integration/tools/testing/test_scenario_tools.py | test_create_scenario_unicode | 108 | null | |
askui/python-sdk | from unittest.mock import patch
import pytest
from pydantic import ValidationError
from askui.tools.askui.askui_controller_client_settings import (
AskUiControllerClientSettings,
)
class TestAskUiControllerClientSettings:
def test_server_address_from_constructor(self) -> None:
"""`server_address` is... | "127.0.0.1:24000" | assert | string_literal | tests/unit/tools/askui/test_askui_controller_client_settings.py | test_server_address_from_constructor | TestAskUiControllerClientSettings | 56 | null |
askui/python-sdk | import pytest
from PIL import Image as PILImage
from askui.locators import Element, Prompt, Text
from askui.locators.locators import Image, Locator
from askui.locators.relatable import CircularDependencyError
from askui.locators.serializers import VlmLocatorSerializer
TEST_IMAGE = PILImage.new("RGB", (100, 100), colo... | 'text "hello"' | assert | string_literal | tests/unit/locators/serializers/test_vlm_locator_serializer.py | test_serialize_text_exact | 26 | null | |
askui/python-sdk | from askui.utils.str_utils import truncate_long_strings
def test_truncate_long_strings_with_dict() -> None:
input_data = {"short": "short", "long": "a" * 101, "nested": {"long": "b" * 101}}
expected = {
"short": "short",
"long": "a" * 20 + "... [shortened]",
"nested": {"long": "b" * 20 ... | expected | assert | variable | tests/unit/utils/test_str_utils.py | test_truncate_long_strings_with_dict | 11 | null | |
askui/python-sdk | import pytest
from pydantic import ValidationError
from askui.utils.not_given import NOT_GIVEN, BaseModelWithNotGiven, NotGiven
def test_notgiven_singleton() -> None:
assert NotGiven() is NOT_GIVEN
assert NotGiven() is NotGiven()
assert repr(NOT_GIVEN) == | "NOT_GIVEN" | assert | string_literal | tests/unit/utils/test_not_given.py | test_notgiven_singleton | 14 | null | |
askui/python-sdk | import uuid
from askui.telemetry.utils import hash_to_uuid4, is_valid_uuid4
def test_hash_to_uuid4_deterministic() -> None:
guid = "12345678901234567890123456789012"
result1 = hash_to_uuid4(guid)
result2 = hash_to_uuid4(guid)
# Same input should produce same output
assert result1 == | result2 | assert | variable | tests/unit/telemetry/test_utils.py | test_hash_to_uuid4_deterministic | 55 | null | |
askui/python-sdk | from askui.utils.str_utils import truncate_long_strings
def test_truncate_long_strings_with_empty_data() -> None:
assert truncate_long_strings({}) == | {} | assert | collection | tests/unit/utils/test_str_utils.py | test_truncate_long_strings_with_empty_data | 51 | null | |
askui/python-sdk | import pathlib
from typing import Literal, Type
import pytest
from PIL import Image as PILImage
from pydantic import BaseModel, RootModel
from pytest_mock import MockerFixture
from typing_extensions import override
from askui import AgentSettings, ComputerAgent, ResponseSchemaBase
from askui.model_providers.image_qa_... | Exception) | pytest.raises | variable | tests/e2e/agent/test_get.py | test_get_with_response_schema_without_additional_properties_with_askui_model_raises | 357 | null | |
askui/python-sdk | from typing import TYPE_CHECKING
from unittest.mock import Mock
from PIL import Image as PILImage
from askui.agent import ComputerAgent
from askui.locators import Element
class TestAgentOffset:
def _setup_mocks(
self, vision_agent: ComputerAgent, github_login_screenshot: PILImage.Image
) -> tuple[Mo... | text) | assert_* | variable | tests/e2e/agent/test_agent_offset.py | test_type_with_positive_offset | TestAgentOffset | 230 | null |
askui/python-sdk | from pathlib import Path
import pytest
from askui.tools.testing.feature_models import (
FeatureCreateParams,
FeatureListQuery,
FeatureModifyParams,
)
from askui.tools.testing.feature_tools import (
CreateFeatureTool,
DeleteFeatureTool,
ListFeatureTool,
ModifyFeatureTool,
RetrieveFeatur... | None | assert | none_literal | tests/integration/tools/testing/test_feature_tools.py | test_create_feature_minimal | 69 | null | |
askui/python-sdk | import pytest
from pydantic import ValidationError
from askui.utils.not_given import NOT_GIVEN, BaseModelWithNotGiven, NotGiven
def test_notgiven_as_method_param() -> None:
def func(x: int | NotGiven = NOT_GIVEN) -> int:
return 42 if isinstance(x, NotGiven) else x
assert func() == 42
assert func... | 5 | assert | numeric_literal | tests/unit/utils/test_not_given.py | test_notgiven_as_method_param | 24 | null | |
askui/python-sdk | import pytest
from PIL import Image as PILImage
from askui.locators import Element, Prompt, Text
from askui.locators.locators import Image, Locator
from askui.locators.relatable import CircularDependencyError
from askui.locators.serializers import VlmLocatorSerializer
TEST_IMAGE = PILImage.new("RGB", (100, 100), colo... | 'text matching regex "h.*o"' | assert | string_literal | tests/unit/locators/serializers/test_vlm_locator_serializer.py | test_serialize_text_regex | 38 | null | |
askui/python-sdk | import re
from pathlib import Path
import pytest
from PIL import Image as PILImage
from askui.locators import AiElement, Element, Image, Prompt, Text
TEST_IMAGE_PATH = Path("tests/fixtures/images/github_com__icon.png")
class TestImageLocator:
_STR_PATTERN = re.compile(
r'^element ".*" located by image ... | 45 | assert | numeric_literal | tests/unit/locators/test_locators.py | test_initialization_with_custom_params | TestImageLocator | 153 | null |
askui/python-sdk | from pathlib import Path
from askui.utils.api_utils import ListQuery, list_resource_paths
def _create_json_files(tmp_path: Path, names: list[str]) -> None:
for name in names:
(tmp_path / name).write_text("{}")
def _create_non_json_files(tmp_path: Path, names: list[str]) -> None:
for name in names:
... | set(files) | assert | func_call | tests/integration/utils/test_api_utils.py | test_list_resource_paths_invalid_file_names | 74 | null | |
askui/python-sdk | import re
import pytest
from PIL import Image as PILImage
from askui.locators import Element, Image, Prompt, Text
from askui.locators.relatable import CircularDependencyError
TEST_IMAGE = PILImage.new("RGB", (100, 100), color="red")
def test_class_without_name_str() -> None:
class_ = Element()
assert str(c... | "element" | assert | string_literal | tests/unit/locators/serializers/test_locator_string_representation.py | test_class_without_name_str | 39 | null | |
askui/python-sdk | import pytest
from pydantic import ValidationError
from askui.utils.not_given import NOT_GIVEN, BaseModelWithNotGiven, NotGiven
def test_notgiven_singleton() -> None:
assert NotGiven() is NOT_GIVEN
assert NotGiven() is | NotGiven() | assert | func_call | tests/unit/utils/test_not_given.py | test_notgiven_singleton | 13 | null | |
askui/python-sdk | from pathlib import Path
import pytest
from askui.tools.testing.feature_models import Feature
from askui.tools.testing.scenario_models import (
ScenarioCreateParams,
ScenarioExample,
ScenarioListQuery,
ScenarioModifyParams,
ScenarioStep,
)
from askui.tools.testing.scenario_tools import (
Creat... | [] | assert | collection | tests/integration/tools/testing/test_scenario_tools.py | test_create_scenario_minimal | 96 | null | |
askui/python-sdk | import uuid
from collections.abc import Generator
import machineid
import pytest
from pytest_mock import MockerFixture
from askui.telemetry.anonymous_id import get_anonymous_id
def reset_caches() -> Generator[None, None, None]:
"""Reset the module-level caches before each test."""
import askui.telemetry.anon... | test_id | assert | variable | tests/unit/telemetry/test_anonymous_id.py | test_get_anonymous_id_uses_random_uuid_when_device_id_unavailable | 74 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.