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 | import pytest
from openchatbi.utils import SimpleStore
class TestSimpleStore:
def sample_texts(self):
"""Sample texts for testing."""
return [
"Python is a programming language",
"Machine learning is a subset of AI",
"Deep learning uses neural networks",
... | 4 | assert | numeric_literal | tests/test_simple_store.py | test_similarity_search | TestSimpleStore | 69 | 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... | None) | assert_* | none_literal | tests/test_memory.py | test_cleanup_async_memory_store | TestMemoryStoreManagement | 129 | 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 TestMessageBasedContextManagement:
def context_manager(self, test_config):
... | 0 | assert | numeric_literal | tests/context_management/test_state_operations.py | test_conversation_summarization | TestMessageBasedContextManagement | 181 | 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"]
... | result[0] | assert | complex_expr | tests/test_tools_search_knowledge.py | test_show_schema_basic | TestSearchKnowledge | 219 | 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... | result | assert | variable | tests/test_text2sql_generate_sql.py | test_generate_sql_node_success | TestText2SQLGenerateSQL | 87 | 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... | SQL_NA | assert | variable | tests/test_text2sql_generate_sql.py | test_execute_sql_node_empty_sql | TestText2SQLGenerateSQL | 139 | 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_tables_a... | result | assert | variable | tests/test_catalog_loader.py | test_get_tables_and_columns | TestDataCatalogLoader | 50 | null |
zhongyu09/openchatbi | from langchain_core.messages import AIMessage, HumanMessage, ToolMessage
from openchatbi.graph_state import AgentState, InputState, OutputState
class TestInputState:
def test_input_state_empty_messages(self):
"""Test InputState with empty messages."""
state = InputState(messages=[])
ass... | [] | assert | collection | tests/test_graph_state.py | test_input_state_empty_messages | TestInputState | 83 | 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_partia... | 3 | assert | numeric_literal | tests/test_incomplete_tool_calls.py | test_partial_incomplete_tool_calls | TestIncompleteToolCallRecovery | 106 | 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... | question | assert | variable | tests/test_tools_ask_human.py | test_ask_human_basic_initialization | TestAskHuman | 19 | 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_nonexistent_table(self):
"""Test schema display for nonexistent table."""
reasoning = "Testing nonexistent table"
table... | 0 | assert | numeric_literal | tests/test_tools_search_knowledge.py | test_show_schema_nonexistent_table | TestSearchKnowledge | 251 | null |
zhongyu09/openchatbi | from openchatbi.context_config import ContextConfig, get_context_config, update_context_config
class TestContextConfig:
def test_default_config_values(self):
"""Test that default configuration has expected values."""
config = ContextConfig()
# Test default values
assert config.en... | True | assert | bool_literal | tests/context_management/test_context_config.py | test_default_config_values | TestContextConfig | 14 | 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_llm_no... | result | assert | variable | tests/test_incomplete_tool_calls.py | test_llm_node_integration_with_recovery | TestIncompleteToolCallRecovery | 166 | 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... | 2 | assert | numeric_literal | tests/context_management/test_edge_cases.py | test_empty_and_none_inputs | TestContextManagementEdgeCases | 43 | 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 ... | error_output | assert | variable | tests/context_management/test_context_manager.py | test_preserve_error_output | TestContextManager | 131 | 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 TestMessageBasedContextManagement:
def context_manager(self, test_config):
... | original_order | assert | variable | tests/context_management/test_state_operations.py | test_message_order_preservation | TestMessageBasedContextManagement | 298 | null |
zhongyu09/openchatbi | import io
from unittest.mock import patch
import pytest
from openchatbi.utils import log
class TestUtilityFunctions:
def test_log_function_empty_message(self):
"""Test logging with empty message."""
captured_output = io.StringIO()
with patch("sys.stderr", captured_output):
l... | None | assert | none_literal | tests/test_utils.py | test_log_function_empty_message | TestUtilityFunctions | 46 | 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.schema_linking import schema_linking
class TestText2SQLSchemaLinking:
def mock_llm(self):
"""Mock LLM for testing."""
llm = ... | "users" | assert | string_literal | tests/test_text2sql_schema_linking.py | test_select_table_success | TestText2SQLSchemaLinking | 96 | 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... | False | assert | bool_literal | tests/test_catalog_loader.py | test_save_to_catalog_store_failure | TestDataCatalogLoader | 116 | null |
zhongyu09/openchatbi | from openchatbi.context_config import ContextConfig, get_context_config, update_context_config
class TestContextConfig:
def test_config_validation_logic(self):
"""Test logical relationships in configuration."""
config = ContextConfig()
# Keep recent messages should be reasonable
... | 0 | assert | numeric_literal | tests/context_management/test_context_config.py | test_config_validation_logic | TestContextConfig | 52 | 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_from_dict(self):
"""Test creating Config from dictionary."""
from unittest.mock import MagicMock
mock_llm = MagicMock()
... | "mysql" | assert | string_literal | tests/test_config_loader.py | test_config_from_dict | TestConfigLoader | 42 | 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... | None | assert | none_literal | tests/test_text2sql_visualization.py | test_complete_workflow_bar_chart | TestVisualizationIntegration | 339 | null |
zhongyu09/openchatbi | from unittest.mock import MagicMock, patch
import pytest
import yaml
from openchatbi.config_loader import Config, ConfigLoader
class TestConfigLoader:
def test_load_bi_config_missing_file(self, temp_dir):
"""Test loading missing BI config file."""
nonexistent_file = temp_dir / "nonexistent_bi.ya... | {} | assert | collection | tests/test_config_loader.py | test_load_bi_config_missing_file | TestConfigLoader | 324 | 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 ... | original_length | assert | variable | tests/context_management/test_context_manager.py | test_manage_context_with_summarization | TestContextManager | 248 | 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 ... | 50 | assert | numeric_literal | tests/context_management/test_context_manager.py | test_trim_code_output | TestContextManager | 119 | 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_message_types(self):
"""Test AgentState with different message types."""
messages = [
HumanMessage... | 3 | assert | numeric_literal | tests/test_graph_state.py | test_agent_state_message_types | TestAgentState | 35 | 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 TestMessageBasedContextManagement:
def context_manager(self, test_config):
... | original_messages | assert | variable | tests/context_management/test_state_operations.py | test_no_operations_when_disabled | TestMessageBasedContextManagement | 41 | 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_with_data(self):
"""Test creating AgentState with initial data."""
messages = [HumanMessage(content="Test mess... | sql | assert | variable | tests/test_graph_state.py | test_agent_state_with_data | TestAgentState | 21 | null |
zhongyu09/openchatbi | from unittest.mock import patch
import pytest
from openchatbi.tool.search_knowledge import search_knowledge, show_schema
class TestSearchKnowledge:
def test_search_knowledge_basic(self):
"""Test basic knowledge search functionality."""
reasoning = "Looking for user information"
query_lis... | result | assert | variable | tests/test_tools_search_knowledge.py | test_search_knowledge_basic | TestSearchKnowledge | 32 | 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 TestMessageBasedContextManagement:
def context_manager(self, test_config):
... | original_sql_content | assert | variable | tests/context_management/test_state_operations.py | test_sql_content_preservation | TestMessageBasedContextManagement | 144 | null |
zhongyu09/openchatbi | import pytest
from openchatbi.text2sql.visualization import ChartType, VisualizationConfig, VisualizationDSL, VisualizationService
class TestVisualizationService:
def test_generate_visualization_dsl_line_chart(self):
"""Test DSL generation for line chart."""
question = "Show sales trend over time... | "sales" | assert | string_literal | tests/test_text2sql_visualization.py | test_generate_visualization_dsl_line_chart | TestVisualizationService | 165 | 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 ... | messages | assert | variable | tests/context_management/test_context_manager.py | test_manage_context_disabled | TestContextManager | 194 | null |
zhongyu09/openchatbi | import pytest
from openchatbi.catalog.catalog_store import CatalogStore
from openchatbi.catalog.store.file_system import FileSystemCatalogStore
class TestFileSystemCatalogStore:
def test_data_path_validation(self):
"""Test data path validation."""
data_warehouse_config = {"uri": "sqlite:///:memor... | (ValueError, FileNotFoundError)) | pytest.raises | collection | tests/test_catalog_store.py | test_data_path_validation | TestFileSystemCatalogStore | 150 | 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_with_data(self):
"""Test creating AgentState with initial data."""
messages = [HumanMessage(content="Test mess... | agent_next_node | assert | variable | tests/test_graph_state.py | test_agent_state_with_data | TestAgentState | 22 | null |
zhongyu09/openchatbi | from langchain_core.messages import AIMessage, HumanMessage, ToolMessage
from openchatbi.graph_state import AgentState, InputState, OutputState
class TestStateIntegration:
def test_input_to_agent_state_conversion(self):
"""Test converting InputState to AgentState."""
input_messages = [HumanMessag... | input_messages | assert | variable | tests/test_graph_state.py | test_input_to_agent_state_conversion | TestStateIntegration | 123 | 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 TestMessageBasedContextManagement:
def context_manager(self, test_config):
... | 1000 | assert | numeric_literal | tests/context_management/test_state_operations.py | test_historical_tool_compression | TestMessageBasedContextManagement | 87 | 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... | mock_tcs | assert | variable | tests/test_memory.py | test_tool_call_schema_property | TestStructuredToolWithRequired | 331 | 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... | json_response | assert | variable | tests/test_text2sql_extraction.py | test_parse_extracted_info_json_valid | TestText2SQLExtraction | 49 | 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_with_data(self):
"""Test creating AgentState with initial data."""
messages = [HumanMessage(content="Test mess... | messages | assert | variable | tests/test_graph_state.py | test_agent_state_with_data | TestAgentState | 20 | null |
zhongyu09/openchatbi | from openchatbi.context_config import ContextConfig, get_context_config, update_context_config
class TestContextConfig:
def test_custom_config_values(self):
"""Test creating config with custom values."""
config = ContextConfig(
enabled=False,
summary_trigger_tokens=8000,
... | 8000 | assert | numeric_literal | tests/context_management/test_context_config.py | test_custom_config_values | TestContextConfig | 38 | 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... | message | assert | variable | tests/test_plotly_utils.py | test_create_empty_chart | TestCreateEmptyChart | 270 | 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 ... | formatted | assert | variable | tests/context_management/test_context_manager.py | test_format_messages_for_summary | TestContextManager | 267 | 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... | None | assert | none_literal | tests/test_memory.py | test_user_profile_optional_fields | TestUserProfile | 43 | 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... | {} | assert | collection | tests/test_text2sql_generate_sql.py | test_generate_sql_node_missing_rewrite_question | TestText2SQLGenerateSQL | 101 | null |
zhongyu09/openchatbi | import pytest
from openchatbi.text2sql.visualization import ChartType, VisualizationConfig, VisualizationDSL, VisualizationService
class TestVisualizationService:
def test_generate_visualization_dsl_pie_chart(self):
"""Test DSL generation for pie chart."""
question = "Show percentage breakdown by... | "pie" | assert | string_literal | tests/test_text2sql_visualization.py | test_generate_visualization_dsl_pie_chart | TestVisualizationService | 203 | 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()... | "TestOrg" | assert | string_literal | tests/test_config_loader.py | test_config_initialization | TestConfigLoader | 22 | 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_with_data(self):
"""Test creating AgentState with initial data."""
messages = [HumanMessage(content="Test mess... | final_answer | assert | variable | tests/test_graph_state.py | test_agent_state_with_data | TestAgentState | 23 | 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 ... | 0 | assert | numeric_literal | tests/context_management/test_context_manager.py | test_message_token_estimation | TestContextManager | 62 | null |
zhongyu09/openchatbi | from langchain_core.messages import AIMessage, HumanMessage, ToolMessage
from openchatbi.graph_state import AgentState, InputState, OutputState
class TestStateIntegration:
def test_state_serialization_compatibility(self):
"""Test that states can be serialized and deserialized."""
original_state =... | original_state["sql"] | assert | complex_expr | tests/test_graph_state.py | test_state_serialization_compatibility | TestStateIntegration | 163 | 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... | str(e) | assert | func_call | tests/test_text2sql_extraction.py | test_information_extraction_error_handling | TestText2SQLExtraction | 222 | 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 ... | len(long_output) | assert | func_call | tests/context_management/test_context_manager.py | test_trim_long_generic_output | TestContextManager | 77 | 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 | string_literal | tests/context_management/test_context_manager.py | test_conversation_summary_disabled | TestContextManager | 146 | null |
zhongyu09/openchatbi | from unittest.mock import MagicMock, patch
import pytest
import yaml
from openchatbi.config_loader import Config, ConfigLoader
class TestConfigLoader:
def test_set_config(self):
"""Test setting configuration from dictionary."""
config_dict = {
"organization": "SetOrg",
"d... | "SetOrg" | assert | string_literal | tests/test_config_loader.py | test_set_config | TestConfigLoader | 305 | 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... | "next" | assert | string_literal | tests/test_text2sql_extraction.py | test_information_extraction_conditional_edges_success | TestText2SQLExtraction | 130 | null |
zhongyu09/openchatbi | import pytest
from pydantic import ValidationError
from openchatbi.tool.ask_human import AskHuman
class TestAskHuman:
def test_ask_human_empty_options(self):
"""Test AskHuman with empty options list."""
ask_human = AskHuman(question="Simple question?", options=[])
assert ask_human.quest... | "Simple question?" | assert | string_literal | tests/test_tools_ask_human.py | test_ask_human_empty_options | TestAskHuman | 26 | 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(
... | "SELECT 1;" | assert | string_literal | tests/test_graph_state.py | test_agent_state_immutability | TestAgentState | 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_load_config_from_file(self, temp_dir):
"""Test loading configuration from YAML file."""
config_data = {
"organization": "Tes... | mock_llm_instance | assert | variable | tests/test_config_loader.py | test_load_config_from_file | TestConfigLoader | 88 | null |
zhongyu09/openchatbi | from langchain_core.messages import AIMessage, HumanMessage, ToolMessage
from openchatbi.graph_state import AgentState, InputState, OutputState
class TestStateIntegration:
def test_state_serialization_compatibility(self):
"""Test that states can be serialized and deserialized."""
original_state =... | original_state["messages"] | assert | complex_expr | tests/test_graph_state.py | test_state_serialization_compatibility | TestStateIntegration | 162 | 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... | msg.content.lower() | assert | func_call | tests/test_incomplete_tool_calls.py | test_incomplete_multiple_tool_calls | TestIncompleteToolCallRecovery | 86 | null |
zhongyu09/openchatbi | import pytest
from openchatbi.utils import SimpleStore
class TestSimpleStore:
def sample_texts(self):
"""Sample texts for testing."""
return [
"Python is a programming language",
"Machine learning is a subset of AI",
"Deep learning uses neural networks",
... | [] | assert | collection | tests/test_simple_store.py | test_empty_store | TestSimpleStore | 91 | null |
zhongyu09/openchatbi | import pytest
from pydantic import ValidationError
from openchatbi.tool.ask_human import AskHuman
class TestAskHuman:
def test_ask_human_serialization(self):
"""Test AskHuman model serialization."""
ask_human = AskHuman(question="Which analysis method?", options=["Statistical", "Machine Learning"... | "Which analysis method?" | assert | string_literal | tests/test_tools_ask_human.py | test_ask_human_serialization | TestAskHuman | 42 | null |
zhongyu09/openchatbi | from langchain_core.messages import AIMessage, HumanMessage, ToolMessage
from openchatbi.graph_state import AgentState, InputState, OutputState
class TestStateIntegration:
def test_input_to_agent_state_conversion(self):
"""Test converting InputState to AgentState."""
input_messages = [HumanMessag... | "" | assert | string_literal | tests/test_graph_state.py | test_input_to_agent_state_conversion | TestStateIntegration | 124 | 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... | len(complex_output) | assert | func_call | tests/context_management/test_edge_cases.py | test_extremely_nested_or_complex_structures | TestContextManagementEdgeCases | 181 | null |
zhongyu09/openchatbi | from openchatbi.context_config import ContextConfig, get_context_config, update_context_config
class TestContextConfig:
def test_default_config_values(self):
"""Test that default configuration has expected values."""
config = ContextConfig()
# Test default values
assert config.ena... | 2000 | assert | numeric_literal | tests/context_management/test_context_config.py | test_default_config_values | TestContextConfig | 17 | 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... | "What is the total revenue by region?" | assert | string_literal | tests/test_text2sql_extraction.py | test_information_extraction_successful | TestText2SQLExtraction | 98 | 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.schema_linking import schema_linking
class TestText2SQLSchemaLinking:
def mock_llm(self):
"""Mock LLM for testing."""
llm = ... | 1 | assert | numeric_literal | tests/test_text2sql_schema_linking.py | test_select_table_success | TestText2SQLSchemaLinking | 95 | null |
zhongyu09/openchatbi | import pytest
from openchatbi.catalog.catalog_store import CatalogStore
from openchatbi.catalog.store.file_system import FileSystemCatalogStore
class TestFileSystemCatalogStore:
def test_filesystem_store_initialization(self, temp_dir):
"""Test FileSystemCatalogStore initialization."""
data_wareho... | data_path | assert | variable | tests/test_catalog_store.py | test_filesystem_store_initialization | TestFileSystemCatalogStore | 37 | null |
zhongyu09/openchatbi | import pytest
from openchatbi.text2sql.visualization import ChartType, VisualizationConfig, VisualizationDSL, VisualizationService
class TestVisualizationService:
def test_generate_visualization_dsl_line_chart(self):
"""Test DSL generation for line chart."""
question = "Show sales trend over time... | "line" | assert | string_literal | tests/test_text2sql_visualization.py | test_generate_visualization_dsl_line_chart | TestVisualizationService | 161 | 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"]
... | 1 | assert | numeric_literal | tests/test_tools_search_knowledge.py | test_show_schema_basic | TestSearchKnowledge | 218 | null |
zhongyu09/openchatbi | from unittest.mock import patch
import pytest
from openchatbi.tool.search_knowledge import search_knowledge, show_schema
class TestSearchKnowledge:
def test_search_knowledge_basic(self):
"""Test basic knowledge search functionality."""
reasoning = "Looking for user information"
query_lis... | False) | assert_* | bool_literal | tests/test_tools_search_knowledge.py | test_search_knowledge_basic | TestSearchKnowledge | 34 | 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... | 2 | assert | numeric_literal | tests/test_incomplete_tool_calls.py | test_incomplete_multiple_tool_calls | TestIncompleteToolCallRecovery | 77 | null |
zhongyu09/openchatbi | import pytest
from openchatbi.catalog.catalog_store import CatalogStore
from openchatbi.catalog.store.file_system import FileSystemCatalogStore
class TestFileSystemCatalogStore:
def test_data_path_validation(self):
"""Test data path validation."""
data_warehouse_config = {"uri": "sqlite:///:memor... | (ValueError, TypeError)) | pytest.raises | collection | tests/test_catalog_store.py | test_data_path_validation | TestFileSystemCatalogStore | 146 | 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 TestMessageBasedContextManagement:
def context_manager(self, test_config):
... | original_error_content | assert | variable | tests/context_management/test_state_operations.py | test_error_message_preservation | TestMessageBasedContextManagement | 111 | 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... | result["info_entities"] | assert | complex_expr | tests/test_text2sql_extraction.py | test_information_extraction_time_period_detection | TestText2SQLExtraction | 204 | null |
zhongyu09/openchatbi | import pytest
from openchatbi.text2sql.visualization import ChartType, VisualizationConfig, VisualizationDSL, VisualizationService
class TestChartType:
def test_chart_type_values(self):
"""Test ChartType enum values."""
assert ChartType.LINE.value == "line"
assert ChartType.BAR.value == "... | "box" | assert | string_literal | tests/test_text2sql_visualization.py | test_chart_type_values | TestChartType | 263 | null |
zhongyu09/openchatbi | from langchain_core.messages import AIMessage, HumanMessage, ToolMessage
from openchatbi.graph_state import AgentState, InputState, OutputState
class TestStateIntegration:
def test_agent_to_output_state_conversion(self):
"""Test converting AgentState to OutputState."""
agent_messages = [HumanMess... | agent_messages | assert | variable | tests/test_graph_state.py | test_agent_to_output_state_conversion | TestStateIntegration | 140 | 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... | 2 | assert | numeric_literal | tests/test_text2sql_generate_sql.py | test_regenerate_sql_node_success | TestText2SQLGenerateSQL | 184 | null |
zhongyu09/openchatbi | from unittest.mock import Mock, patch
import pytest
from langchain_core.messages import AIMessage, HumanMessage, ToolMessage
from langchain_core.tools import StructuredTool
from openchatbi.agent_graph import _build_graph_core, agent_llm_call, build_agent_graph_async, build_agent_graph_sync
from openchatbi.context_con... | original_count | assert | variable | tests/context_management/test_agent_graph_integration.py | test_full_context_management_flow | TestAgentGraphIntegration | 258 | null |
zhongyu09/openchatbi | from unittest.mock import Mock, patch
import pytest
from langchain_core.messages import AIMessage, HumanMessage, ToolMessage
from langchain_core.tools import StructuredTool
from openchatbi.agent_graph import _build_graph_core, agent_llm_call, build_agent_graph_async, build_agent_graph_sync
from openchatbi.context_con... | result | assert | variable | tests/context_management/test_agent_graph_integration.py | test_agent_llm_node_with_context_manager | TestAgentGraphIntegration | 73 | 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 ... | summary | assert | variable | tests/context_management/test_context_manager.py | test_conversation_summary_success | TestContextManager | 166 | null |
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_catalog_store(self, temp_dir):
"""Test loading configuration with catalog store."""
config_data = {
"organi... | None | assert | none_literal | tests/test_config_loader.py | test_load_config_with_catalog_store | TestConfigLoader | 187 | 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_no_mes... | [] | assert | collection | tests/test_incomplete_tool_calls.py | test_no_messages | TestIncompleteToolCallRecovery | 19 | 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(
... | "updated_node" | assert | string_literal | tests/test_graph_state.py | test_agent_state_immutability | TestAgentState | 64 | null |
zhongyu09/openchatbi | from unittest.mock import MagicMock, patch
import pytest
import yaml
from openchatbi.config_loader import Config, ConfigLoader
class TestConfigLoader:
def test_set_config(self):
"""Test setting configuration from dictionary."""
config_dict = {
"organization": "SetOrg",
"d... | "postgresql" | assert | string_literal | tests/test_config_loader.py | test_set_config | TestConfigLoader | 306 | 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_detailed_info(self):
"""Test detailed schema information."""
reasoning = "Showing detailed schema"
tables = ["user_data... | 2 | assert | numeric_literal | tests/test_tools_search_knowledge.py | test_show_schema_detailed_info | TestSearchKnowledge | 236 | null |
zhongyu09/openchatbi | from openchatbi.context_config import ContextConfig, get_context_config, update_context_config
class TestContextConfig:
def test_custom_config_values(self):
"""Test creating config with custom values."""
config = ContextConfig(
enabled=False,
summary_trigger_tokens=8000,
... | 5 | assert | numeric_literal | tests/context_management/test_context_config.py | test_custom_config_values | TestContextConfig | 39 | 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_catalog_load... | mock_engine | assert | variable | tests/test_catalog_loader.py | test_catalog_loader_initialization | TestDataCatalogLoader | 26 | null |
zhongyu09/openchatbi | import pytest
from openchatbi.text2sql.visualization import ChartType, VisualizationConfig, VisualizationDSL, VisualizationService
class TestVisualizationService:
def test_generate_visualization_dsl_line_chart(self):
"""Test DSL generation for line chart."""
question = "Show sales trend over time... | "date" | assert | string_literal | tests/test_text2sql_visualization.py | test_generate_visualization_dsl_line_chart | TestVisualizationService | 164 | 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_tables_a... | 1 | assert | numeric_literal | tests/test_catalog_loader.py | test_get_tables_and_columns | TestDataCatalogLoader | 51 | 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... | "" | assert | string_literal | tests/test_text2sql_generate_sql.py | test_regenerate_sql_empty_response | TestText2SQLGenerateSQL | 301 | 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... | 0 | assert | numeric_literal | tests/test_plotly_utils.py | test_create_line_chart_success | TestPlotlyChartCreation | 66 | null |
zhongyu09/openchatbi | import pytest
from openchatbi.catalog.catalog_store import CatalogStore
from openchatbi.catalog.store.file_system import FileSystemCatalogStore
class TestFileSystemCatalogStore:
def test_concurrent_access(self, mock_catalog_store):
"""Test concurrent access to catalog store."""
import threading
... | 0 | assert | numeric_literal | tests/test_catalog_store.py | test_concurrent_access | TestFileSystemCatalogStore | 186 | null |
zhongyu09/openchatbi | import pytest
from pydantic import ValidationError
from openchatbi.tool.ask_human import AskHuman
class TestAskHuman:
def test_ask_human_empty_options(self):
"""Test AskHuman with empty options list."""
ask_human = AskHuman(question="Simple question?", options=[])
assert ask_human.questi... | [] | assert | collection | tests/test_tools_ask_human.py | test_ask_human_empty_options | TestAskHuman | 27 | null |
zhongyu09/openchatbi | import pytest
from openchatbi.text2sql.visualization import ChartType, VisualizationConfig, VisualizationDSL, VisualizationService
class TestVisualizationService:
def test_generate_visualization_dsl_pie_chart(self):
"""Test DSL generation for pie chart."""
question = "Show percentage breakdown by... | "count" | assert | string_literal | tests/test_text2sql_visualization.py | test_generate_visualization_dsl_pie_chart | TestVisualizationService | 205 | null |
zhongyu09/openchatbi | import io
from unittest.mock import patch
import pytest
from openchatbi.utils import log
class TestUtilityFunctions:
def test_log_function_timestamp_format(self):
"""Test that log includes timestamp information."""
captured_output = io.StringIO()
with patch("sys.stderr", captured_output... | len("Timestamp test") | assert | func_call | tests/test_utils.py | test_log_function_timestamp_format | TestUtilityFunctions | 147 | 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... | "EST" | assert | string_literal | tests/test_memory.py | test_user_profile_serialization | TestUserProfile | 63 | null |
zhongyu09/openchatbi | from openchatbi.context_config import ContextConfig, get_context_config, update_context_config
class TestContextConfigPresets:
def test_aggressive_compression_config(self):
"""Test configuration for aggressive context compression."""
config = ContextConfig(
enabled=True,
su... | 10 | assert | numeric_literal | tests/context_management/test_context_config.py | test_aggressive_compression_config | TestContextConfigPresets | 139 | null |
zhongyu09/openchatbi | import io
from unittest.mock import patch
import pytest
from openchatbi.utils import log
class TestUtilityFunctions:
def test_log_function_basic(self):
"""Test basic logging functionality."""
# Capture stdout
captured_output = io.StringIO()
with patch("sys.stderr", captured_outp... | output | assert | variable | tests/test_utils.py | test_log_function_basic | TestUtilityFunctions | 23 | 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... | 0 | assert | numeric_literal | tests/context_management/test_edge_cases.py | test_unicode_and_encoding_edge_cases | TestContextManagementEdgeCases | 159 | 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 TestMessageBasedContextManagement:
def context_manager(self, test_config):
... | 2 | assert | numeric_literal | tests/context_management/test_state_operations.py | test_recent_messages_always_preserved | TestMessageBasedContextManagement | 268 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.