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 |
|---|---|---|---|---|---|---|---|---|---|
cased/kit | import tempfile
from pathlib import Path
from unittest.mock import patch
import pytest
from kit import Repository
from kit.mcp.dev_server import KitServerLogic
class TestGrepIntegration:
def test_python_api_grep(self, test_repo):
"""Test grep functionality through Python API."""
repo = Repositor... | 1 | assert | numeric_literal | tests/test_grep_integration.py | test_python_api_grep | TestGrepIntegration | 54 | null |
cased/kit | import os
import tempfile
from pathlib import Path
from unittest.mock import patch
import pytest
from kit.mcp.dev_server import (
GetFileTreeParams,
LocalDevServerLogic,
WarmCacheParams,
)
from kit.repository import Repository
class TestGrepTimeoutAndEarlyTermination:
def repo(self):
"""Crea... | 2 | assert | numeric_literal | tests/test_large_codebase.py | test_grep_early_termination | TestGrepTimeoutAndEarlyTermination | 65 | null |
cased/kit | import subprocess
import tempfile
from pathlib import Path
from src.kit.api.registry import PersistentRepoRegistry, _canonical, path_to_id
class TestRegistryDeterministicIDs:
def test_remote_url_with_ref(self):
"""Test deterministic IDs for remote URLs with refs."""
registry = PersistentRepoRegis... | id3 | assert | variable | tests/test_registry_deterministic.py | test_remote_url_with_ref | TestRegistryDeterministicIDs | 111 | null |
cased/kit | import tempfile
from pathlib import Path
from kit import ContextExtractor
def test_chunk_file_by_symbols():
with tempfile.TemporaryDirectory() as tmpdir:
fpath = f"{tmpdir}/test.py"
with open(fpath, "w") as f:
f.write("""class Foo:\n def bar(self): pass\ndef baz(): pass\n""")
... | names | assert | variable | tests/test_context_extractor.py | test_chunk_file_by_symbols | 26 | null | |
cased/kit | from unittest.mock import MagicMock, patch
import pytest
from kit.package_search import ChromaPackageSearch
class TestChromaPackageSearch:
def mock_api_key(self, monkeypatch):
"""Set mock API key for tests."""
monkeypatch.setenv("CHROMA_PACKAGE_SEARCH_API_KEY", "test_api_key")
def client(se... | [] | assert | collection | tests/test_package_search.py | test_empty_results | TestChromaPackageSearch | 224 | null |
cased/kit | import re
import pytest
from kit.pr_review.priority_filter import (
MAJOR_SECTION_PATTERN,
MAX_LINES,
MIN_MEANINGFUL_LENGTH,
PRIORITY_HEADER_PATTERNS,
PRIORITY_SECTION_PATTERNS,
_extract_priority_level,
_filter_priority_content,
_is_major_section_header,
_is_meaningful_content,
... | "low" | assert | string_literal | tests/test_priority_filtering.py | test_priority_enum_values | TestPriorityEnum | 40 | null |
cased/kit | from unittest.mock import MagicMock, patch
import pytest
from kit.doc_providers import DocumentationService, UpstashProvider
class TestUpstashProvider:
@patch("httpx.Client.get")
def test_search_success(self, mock_get):
"""Test successful package search."""
mock_response = MagicMock()
... | 2 | assert | numeric_literal | tests/test_doc_providers.py | test_search_success | TestUpstashProvider | 66 | null |
cased/kit | import os
import tempfile
import pytest
from kit import Repository
def test_repo_get_file_tree_and_symbols():
with tempfile.TemporaryDirectory() as tmpdir:
os.makedirs(f"{tmpdir}/foo/bar")
with open(f"{tmpdir}/foo/bar/baz.py", "w") as f:
f.write("""
class Foo:
def bar(self): pass
... | names | assert | variable | tests/test_repo.py | test_repo_get_file_tree_and_symbols | 25 | null | |
cased/kit | from kit.tree_sitter_symbol_extractor import TreeSitterSymbolExtractor
def test_tsx_duplicate_symbols():
"""Ensure TSX (using TypeScript fallback queries) does not return duplicate symbols."""
code = """
import React from 'react';
export interface Props {
title: string;
}
export class Header extends React.... | len(set(keys)) | assert | func_call | tests/test_tsx_duplicate_symbols.py | test_tsx_duplicate_symbols | 26 | null | |
cased/kit | import tempfile
from kit import RepoMapper
def test_extract_symbols():
with tempfile.TemporaryDirectory() as tmpdir:
pyfile = f"{tmpdir}/a.py"
with open(pyfile, "w") as f:
f.write("""
class Foo:
def bar(self): pass
def baz(): pass
""")
mapper = RepoMapper(tmpdir)
s... | names | assert | variable | tests/test_repo_mapper.py | test_extract_symbols | 33 | null | |
cased/kit | import os
import sys
import tempfile
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent.parent / "src"))
from kit import Repository
def test_rust_dependency_analyzer_basic():
"""Test basic Rust crate analysis."""
with tempfile.TemporaryDirectory() as tmpdir:
# Create Cargo.toml
... | graph | assert | variable | tests/test_rust_dependency_analyzer.py | test_rust_dependency_analyzer_basic | 54 | null | |
cased/kit | import os
import tempfile
from pathlib import Path
from unittest.mock import MagicMock, patch
import pytest
from typer.testing import CliRunner
from kit.cli import app
def runner():
"""Create a CLI test runner."""
return CliRunner()
def temp_git_repo():
"""Create a temporary git repository with sample c... | 1 | assert | numeric_literal | tests/test_cli_local_review.py | test_review_missing_target | TestCLILocalReview | 79 | null |
cased/kit | import os
import tempfile
from pathlib import Path
from unittest.mock import MagicMock, patch
import pytest
from kit.pr_review.config import ReviewConfig
from kit.pr_review.local_reviewer import LocalChange, LocalDiffReviewer
def mock_config():
"""Create a mock ReviewConfig for testing."""
config = MagicMock... | "" | assert | string_literal | tests/test_local_review.py | test_get_commit_info | TestLocalDiffReviewer | 90 | null |
cased/kit | import tempfile
from pathlib import Path
from unittest.mock import MagicMock, patch
from kit.tree_sitter_symbol_extractor import LanguagePlugin, TreeSitterSymbolExtractor
class TestQueryLoading:
def setup_method(self):
"""Reset plugins before each test."""
TreeSitterSymbolExtractor.reset_plugins(... | "" | assert | string_literal | tests/test_tree_sitter_plugin_system.py | test_load_queries_handles_missing_files | TestQueryLoading | 348 | null |
cased/kit | import tempfile
from pathlib import Path
import pytest
from kit.mcp.dev_server import (
DeepResearchParams,
LocalDevServerLogic,
)
class TestLocalDevServerLogic:
def server(self):
"""Create a server instance."""
return LocalDevServerLogic()
def test_open_repository(self, server):
... | "repo_0" | assert | string_literal | tests/test_dev_mcp.py | test_open_repository | TestLocalDevServerLogic | 37 | null |
cased/kit | import os
import tempfile
from pathlib import Path
from unittest.mock import MagicMock, patch
import pytest
from kit.pr_review.config import ReviewConfig
from kit.pr_review.local_reviewer import LocalChange, LocalDiffReviewer
def mock_config():
"""Create a mock ReviewConfig for testing."""
config = MagicMock... | None | assert | none_literal | tests/test_local_review.py | test_init | TestLocalDiffReviewer | 60 | null |
cased/kit | import tempfile
from pathlib import Path
from unittest.mock import patch
import pytest
from kit import Repository
from kit.mcp.dev_server import KitServerLogic
class TestGrepIntegration:
def test_smart_exclusions_behavior(self, test_repo):
"""Test that smart exclusions work correctly."""
repo = ... | 0 | assert | numeric_literal | tests/test_grep_integration.py | test_smart_exclusions_behavior | TestGrepIntegration | 133 | null |
cased/kit | import json
import subprocess
import tempfile
from pathlib import Path
import pytest
import typer.testing
from kit.cli import app
def runner():
"""Create a typer test runner."""
return typer.testing.CliRunner()
def temp_git_repo():
"""Create a temporary git repository for testing."""
with tempfile.T... | 0 | assert | numeric_literal | tests/test_cli_ref.py | test_git_info_command | TestCLIRefParameter | 61 | null |
cased/kit | from unittest.mock import MagicMock, patch
import pytest
from kit.package_search import ChromaPackageSearch
class TestChromaPackageSearch:
def mock_api_key(self, monkeypatch):
"""Set mock API key for tests."""
monkeypatch.setenv("CHROMA_PACKAGE_SEARCH_API_KEY", "test_api_key")
def client(se... | True | assert | bool_literal | tests/test_package_search.py | test_get_package_info | TestChromaPackageSearch | 306 | null |
cased/kit | from unittest.mock import MagicMock, patch
class TestOllamaClient:
def test_init_creates_own_session(self):
"""Test that OllamaClient creates its own session when none provided."""
from kit.ollama_client import OllamaClient
with patch("requests.Session") as mock_session_class:
... | True | assert | bool_literal | tests/test_ollama_client.py | test_init_creates_own_session | TestOllamaClient | 22 | null |
cased/kit | import tempfile
from pathlib import Path
from unittest.mock import MagicMock, patch
import pytest
from kit.pr_review.base_reviewer import BaseReviewer
from kit.pr_review.config import GitHubConfig, LLMConfig, LLMProvider, ReviewConfig
def review_config():
"""Create a test ReviewConfig."""
return ReviewConfig... | diff2 | assert | variable | tests/test_base_reviewer.py | test_caches_diff | TestGetPrDiff | 165 | null |
cased/kit | import json
import tempfile
from pathlib import Path
from unittest.mock import MagicMock, patch
import pytest
from typer.testing import CliRunner
from kit.cli import app
def runner():
"""Create a CLI runner for testing."""
return CliRunner()
def temp_output_file():
"""Create a temporary output file."""
... | 1 | assert | numeric_literal | tests/test_cli_dependencies.py | test_cycles_output_to_file | TestDependenciesCommand | 163 | null |
cased/kit | import subprocess
import tempfile
from pathlib import Path
import pytest
from kit import Repository
def test_grep_no_matches():
"""Test grep when no matches found."""
with tempfile.TemporaryDirectory() as temp_dir:
repo_path = Path(temp_dir)
(repo_path / "test.py").write_text("print('hello w... | 0 | assert | numeric_literal | tests/test_grep_functionality.py | test_grep_no_matches | 110 | null | |
cased/kit | import tempfile
from pathlib import Path
from kit import ContextExtractor
def test_chunk_file_by_symbols():
with tempfile.TemporaryDirectory() as tmpdir:
fpath = f"{tmpdir}/test.py"
with open(fpath, "w") as f:
f.write("""class Foo:\n def bar(self): pass\ndef baz(): pass\n""")
... | types | assert | variable | tests/test_context_extractor.py | test_chunk_file_by_symbols | 29 | null | |
cased/kit | import os
import tempfile
from kit import CodeSearcher
from kit.code_searcher import SearchOptions
def test_search_multiple_matches_per_file():
"""Test finding multiple matches in the same file."""
with tempfile.TemporaryDirectory() as tmpdir:
pyfile = os.path.join(tmpdir, "test.py")
with open... | 3 | assert | numeric_literal | tests/test_code_searcher.py | test_search_multiple_matches_per_file | 171 | null | |
cased/kit | import pytest
import tree_sitter
from tree_sitter_language_pack import get_language, get_parser
from kit.tree_sitter_symbol_extractor import TreeSitterSymbolExtractor
def test_extract_symbols_typescript():
"""Test TypeScript symbol extraction with new API."""
ts_code = """
interface User {
id: number;
... | "class" | assert | string_literal | tests/test_tree_sitter_api_compat.py | test_extract_symbols_typescript | 110 | null | |
cased/kit | import socket
import threading
import time
from pathlib import Path
import pytest
import requests
import uvicorn
SERVER_HOST = "127.0.0.1"
def _find_free_port() -> int:
"""Ask the OS for an unused port."""
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.bind((SERVER_HOST, 0))
r... | content_resp.text | assert | complex_expr | tests/integration/test_api_live.py | test_get_file_content_live | 76 | null | |
cased/kit | import os
import re
import sys
import types
from unittest.mock import MagicMock, patch
import pytest
from kit.summaries import AnthropicConfig, GoogleConfig, LLMError, OpenAIConfig, Summarizer
from kit.summaries import genai as kit_s_genai
def mock_repo():
"""Provides a MagicMock instance of the Repository with ... | "" | assert | string_literal | tests/test_summaries.py | test_empty_input | TestThinkingTokenStripping | 867 | null |
cased/kit | import re
import pytest
from typer.testing import CliRunner
from kit.cli import app
def runner():
"""Create a CLI runner for testing."""
return CliRunner()
def strip_ansi_codes(text: str) -> str:
"""Remove ANSI color codes from text for easier testing."""
ansi_escape = re.compile(r"\x1B(?:[@-Z\\-_]|... | 1 | assert | numeric_literal | tests/test_cli_search_semantic.py | test_invalid_chunk_by_parameter | TestSearchSemanticCommand | 56 | null |
cased/kit | import tempfile
import time
from pathlib import Path
from unittest.mock import patch
import pytest
from kit.incremental_analyzer import FileAnalysisCache, IncrementalAnalyzer
class TestFileAnalysisCache:
def test_stale_entry_cleanup(self):
"""Test cleanup of stale cache entries."""
with tempfile... | 1 | assert | numeric_literal | tests/test_incremental_analyzer.py | test_stale_entry_cleanup | TestFileAnalysisCache | 118 | null |
cased/kit | import subprocess
import tempfile
from pathlib import Path
import pytest
from kit import Repository
def test_grep_basic():
"""Test basic grep functionality."""
with tempfile.TemporaryDirectory() as temp_dir:
repo_path = Path(temp_dir)
# Create test files with content
(repo_path / "ma... | 3 | assert | numeric_literal | tests/test_grep_functionality.py | test_grep_basic | 33 | null | |
cased/kit | import os
import subprocess
import time
import pytest
import requests
from kit import Repository
from kit.pr_review.config import GitHubConfig, LLMConfig, LLMProvider, ReviewConfig
from kit.pr_review.cost_tracker import CostTracker
from kit.pr_review.reviewer import PRReviewer
from kit.summaries import OllamaConfig
... | LLMProvider.OLLAMA | assert | complex_expr | tests/test_ollama_integration_real.py | test_ollama_pr_review_simulation | TestOllamaIntegration | 181 | null |
cased/kit | import subprocess
import tempfile
from pathlib import Path
from unittest.mock import patch
import pytest
from kit.mcp.dev_server import KitServerLogic
def temp_git_repo():
"""Create a temporary git repository for testing."""
with tempfile.TemporaryDirectory() as temp_dir:
# Initialize git repo
... | "." | assert | string_literal | tests/test_mcp_ref.py | test_open_repository_params_includes_ref | TestMCPRefParameter | 212 | null |
cased/kit | import re
from src.kit.pr_review.diff_parser import DiffParser
from src.kit.pr_review.validator import validate_review_quality
class TestRealWorldScenarios:
def test_rename_and_modification_diff(self):
"""Test parsing diffs with file renames and modifications."""
rename_diff = '''diff --git a/old... | ranges | assert | variable | tests/test_line_accuracy_validation.py | test_rename_and_modification_diff | TestRealWorldScenarios | 331 | null |
cased/kit | import os
import tempfile
from kit import CodeSearcher
from kit.code_searcher import SearchOptions
def test_search_text_multiple_files():
with tempfile.TemporaryDirectory() as tmpdir:
files = ["a.py", "b.py", "c.txt"]
for fname in files:
with open(os.path.join(tmpdir, fname), "w") as f... | 2 | assert | numeric_literal | tests/test_code_searcher.py | test_search_text_multiple_files | 32 | null | |
cased/kit | from unittest.mock import Mock, patch
from kit.tree_sitter_symbol_extractor import TreeSitterSymbolExtractor
class TestTreeSitterCompatibility:
def test_real_typescript_extraction(self):
"""Test with real TypeScript code to ensure compatibility."""
typescript_code = """
interface User {
id: n... | "class" | assert | string_literal | tests/test_tree_sitter_compatibility.py | test_real_typescript_extraction | TestTreeSitterCompatibility | 193 | null |
cased/kit | import subprocess
import time
import pytest
import requests
class TestAPIRefParameter:
def test_git_info_endpoint(self, test_server):
"""Test the git-info endpoint."""
# First create a repository
response = requests.post(f"{test_server}/repository", json={"path_or_url": "."})
asse... | 7 | assert | numeric_literal | tests/test_api_ref.py | test_git_info_endpoint | TestAPIRefParameter | 83 | null |
cased/kit | import tempfile
from pathlib import Path
import pytest
from kit.mcp.dev_server import (
DeepResearchParams,
LocalDevServerLogic,
)
class TestLocalDevServerLogic:
def server(self):
"""Create a server instance."""
return LocalDevServerLogic()
def test_list_tools(self, server):
... | 8 | assert | numeric_literal | tests/test_dev_mcp.py | test_list_tools | TestLocalDevServerLogic | 83 | null |
cased/kit | from unittest.mock import MagicMock, Mock, patch
import pytest
from kit.pr_review.config import GitHubConfig, LLMConfig, LLMProvider, ReviewConfig
from kit.pr_review.cost_tracker import CostTracker
from kit.summaries import LLMError, OllamaConfig, Summarizer, _strip_thinking_tokens
def mock_repo():
"""Provides a... | "ollama" | assert | string_literal | tests/test_ollama_integration.py | test_ollama_config_defaults | TestOllamaConfig | 37 | null |
cased/kit | import json
import os
import sys
import tempfile
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent.parent / "src"))
from kit import Repository
def test_dependency_report():
"""Test generating a comprehensive dependency report."""
with tempfile.TemporaryDirectory() as tmpdir:
os.ma... | report | assert | variable | tests/test_python_dependency_analyzer.py | test_dependency_report | 289 | null | |
cased/kit | import os
import tempfile
from pathlib import Path
from unittest.mock import MagicMock, patch
import pytest
from kit.pr_review.config import ReviewConfig
from kit.pr_review.local_reviewer import LocalChange, LocalDiffReviewer
def mock_config():
"""Create a mock ReviewConfig for testing."""
config = MagicMock... | 1 | assert | numeric_literal | tests/test_local_review.py | test_prepare_local_change | TestLocalDiffReviewer | 152 | null |
cased/kit | import os
import tempfile
from pathlib import Path
from unittest.mock import MagicMock, patch
import pytest
from kit.mcp.dev_server import KitServerLogic, MCPError, ReviewDiffParams
def server_logic():
"""Create a KitServerLogic instance for testing."""
return KitServerLogic()
def mock_repo(server_logic):
... | "gpt-4" | assert | string_literal | tests/mcp/test_review_diff.py | test_review_diff_params_validation | TestReviewDiff | 68 | null |
cased/kit | import subprocess
import tempfile
from pathlib import Path
import pytest
from kit import Repository
def test_grep_case_sensitive():
"""Test case sensitivity in grep."""
with tempfile.TemporaryDirectory() as temp_dir:
repo_path = Path(temp_dir)
(repo_path / "test.py").write_text("hello\nHELLO... | 1 | assert | numeric_literal | tests/test_grep_functionality.py | test_grep_case_sensitive | 51 | null | |
cased/kit | import os
import sys
import tempfile
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent.parent / "src"))
from kit import Repository
def test_go_dependency_analyzer_cycles():
"""Test cycle detection in Go packages."""
with tempfile.TemporaryDirectory() as tmpdir:
with open(f"{tmpdir... | 0 | assert | numeric_literal | tests/test_go_dependency_analyzer.py | test_go_dependency_analyzer_cycles | 170 | null | |
cased/kit | import json
import os
import tempfile
from kit import MultiRepo, Repository
def create_test_repo(tmpdir: str, name: str, files: dict) -> str:
"""Create a test repository with given files."""
repo_path = os.path.join(tmpdir, name)
os.makedirs(repo_path, exist_ok=True)
for file_path, content in files.i... | 5 | assert | numeric_literal | tests/test_multi_repo.py | test_multi_repo_summarize_file_counts | 564 | null | |
cased/kit | import json
import tempfile
from pathlib import Path
from unittest.mock import MagicMock, patch
import pytest
from typer.testing import CliRunner
from kit.cli import app
def runner():
"""Create a CLI runner for testing."""
return CliRunner()
def temp_output_file():
"""Create a temporary output file."""
... | 0 | assert | numeric_literal | tests/test_cli_dependencies.py | test_missing_language_parameter | TestDependenciesCommand | 71 | null |
cased/kit | from unittest.mock import Mock, patch
from kit.tree_sitter_symbol_extractor import TreeSitterSymbolExtractor
class TestTreeSitterCompatibility:
def test_matches_api_success(self):
"""Test successful extraction using matches() API."""
code = "function test() { return 42; }"
# Mock query w... | "test" | assert | string_literal | tests/test_tree_sitter_compatibility.py | test_matches_api_success | TestTreeSitterCompatibility | 46 | null |
cased/kit | import subprocess
import time
import pytest
import requests
class TestAPIRefParameter:
def test_file_tree_with_ref(self, test_server):
"""Test file-tree endpoint with ref parameter."""
# Create repository with ref
response = requests.post(f"{test_server}/repository", json={"path_or_url": ... | 0 | assert | numeric_literal | tests/test_api_ref.py | test_file_tree_with_ref | TestAPIRefParameter | 112 | null |
cased/kit | from kit.pr_review.line_ref_fixer import LineRefFixer
SIMPLE_DIFF = """diff --git a/foo.py b/foo.py
@@ -10,3 +10,4 @@ def func():
a = 1
- b = 2
+ b = 3
+ c = 4
"""
BAD_COMMENT = "Issue at foo.py:10 is wrong. Another range foo.py:10-11 is wrong too."
def test_line_ref_fix_simple():
fixed, fixes = Li... | [] | assert | collection | tests/test_line_ref_fix.py | test_line_ref_fix_simple | 19 | null | |
cased/kit | import os
import tempfile
import pytest
from kit import Repository
def test_repo_get_file_tree_and_symbols():
with tempfile.TemporaryDirectory() as tmpdir:
os.makedirs(f"{tmpdir}/foo/bar")
with open(f"{tmpdir}/foo/bar/baz.py", "w") as f:
f.write("""
class Foo:
def bar(self): pass
... | types | assert | variable | tests/test_repo.py | test_repo_get_file_tree_and_symbols | 28 | null | |
cased/kit | import tempfile
from pathlib import Path
import pytest
from kit.mcp.dev_server import (
DeepResearchParams,
LocalDevServerLogic,
)
class TestMCPServerIntegration:
@pytest.mark.asyncio
async def test_server_initialization(self):
"""Test that the server can be initialized."""
from kit.... | None | assert | none_literal | tests/test_dev_mcp.py | test_server_initialization | TestMCPServerIntegration | 105 | null |
cased/kit | import os
import tempfile
from kit import CodeSearcher
from kit.code_searcher import SearchOptions
def test_search_case_insensitive():
"""Test case-insensitive search."""
with tempfile.TemporaryDirectory() as tmpdir:
pyfile = os.path.join(tmpdir, "test.py")
with open(pyfile, "w") as f:
... | 0 | assert | numeric_literal | tests/test_code_searcher.py | test_search_case_insensitive | 108 | null | |
cased/kit | import os
import tempfile
from pathlib import Path
from unittest.mock import MagicMock, patch
import pytest
from kit.pr_review.config import ReviewConfig
from kit.pr_review.local_reviewer import LocalChange, LocalDiffReviewer
def mock_config():
"""Create a mock ReviewConfig for testing."""
config = MagicMock... | diff | assert | variable | tests/test_local_review.py | test_get_diff | TestLocalDiffReviewer | 108 | null |
cased/kit | import os
import tempfile
from pathlib import Path
from unittest.mock import MagicMock, patch
import pytest
from typer.testing import CliRunner
from kit.cli import app
from kit.pr_review.local_reviewer import LocalDiffReviewer
def runner():
"""Create a CLI test runner."""
return CliRunner()
def temp_git_rep... | 0 | assert | numeric_literal | tests/test_local_diff_parsing.py | test_special_diff_formats | TestLocalDiffCLIParsing | 218 | null |
cased/kit | import tempfile
from pathlib import Path
from kit import ContextExtractor
def test_extract_context_around_line():
with tempfile.TemporaryDirectory() as tmpdir_str:
tmpdir = Path(tmpdir_str)
extractor = ContextExtractor(tmpdir_str)
# --- Test 1: Python file, line within a function (existin... | None | assert | none_literal | tests/test_context_extractor.py | test_extract_context_around_line | 48 | null | |
cased/kit | import os
import sys
import tempfile
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent.parent / "src"))
from kit import Repository
def test_go_dependency_analyzer_basic():
"""Test basic functionality of the GoDependencyAnalyzer."""
with tempfile.TemporaryDirectory() as tmpdir:
# C... | graph | assert | variable | tests/test_go_dependency_analyzer.py | test_go_dependency_analyzer_basic | 53 | null | |
cased/kit | import tempfile
from pathlib import Path
from unittest.mock import MagicMock, patch
import pytest
from kit.pr_review.base_reviewer import BaseReviewer
from kit.pr_review.config import GitHubConfig, LLMConfig, LLMProvider, ReviewConfig
def review_config():
"""Create a test ReviewConfig."""
return ReviewConfig... | 1 | assert | numeric_literal | tests/test_base_reviewer.py | test_caches_diff | TestGetPrDiff | 166 | null |
cased/kit | import os
import tempfile
from pathlib import Path
from unittest.mock import patch
import pytest
from kit.mcp.dev_server import (
GetFileTreeParams,
LocalDevServerLogic,
WarmCacheParams,
)
from kit.repository import Repository
class TestWarmCacheTool:
def server_with_repo(self):
"""Create a ... | result | assert | variable | tests/test_large_codebase.py | test_warm_cache_file_tree | TestWarmCacheTool | 170 | null |
cased/kit | import os
import unittest
from pathlib import Path
class ResourceLoadingTest(unittest.TestCase):
def test_extraction_from_different_working_directory(self):
"""Verify that symbol extraction works when run from a different working directory."""
# Save current working directory
try:
... | "tmp" | assert | string_literal | tests/test_resource_loading.py | test_extraction_from_different_working_directory | ResourceLoadingTest | 22 | null |
cased/kit | import os
import tempfile
from pathlib import Path
from unittest.mock import MagicMock, patch
import pytest
from kit.pr_review.config import ReviewConfig
from kit.pr_review.local_reviewer import LocalChange, LocalDiffReviewer
def mock_config():
"""Create a mock ReviewConfig for testing."""
config = MagicMock... | "main" | assert | string_literal | tests/test_local_review.py | test_parse_diff_spec | TestLocalDiffReviewer | 69 | null |
cased/kit | import tempfile
import time
from pathlib import Path
from unittest.mock import patch
import pytest
from kit.incremental_analyzer import FileAnalysisCache, IncrementalAnalyzer
class TestIncrementalAnalyzer:
def test_unsupported_file_types(self):
"""Test handling of unsupported file types."""
with... | [] | assert | collection | tests/test_incremental_analyzer.py | test_unsupported_file_types | TestIncrementalAnalyzer | 271 | null |
cased/kit | import os
import subprocess
import time
import pytest
import requests
from kit import Repository
from kit.pr_review.config import GitHubConfig, LLMConfig, LLMProvider, ReviewConfig
from kit.pr_review.cost_tracker import CostTracker
from kit.pr_review.reviewer import PRReviewer
from kit.summaries import OllamaConfig
... | result | assert | variable | tests/test_ollama_integration_real.py | test_ollama_api_direct | TestOllamaIntegration | 208 | null |
cased/kit | import tempfile
import time
from pathlib import Path
from unittest.mock import patch
import pytest
from kit.incremental_analyzer import FileAnalysisCache, IncrementalAnalyzer
class TestIncrementalAnalyzer:
def test_single_file_analysis(self):
"""Test analysis of a single file."""
with tempfile.T... | 2 | assert | numeric_literal | tests/test_incremental_analyzer.py | test_single_file_analysis | TestIncrementalAnalyzer | 184 | null |
cased/kit | from src.kit.pr_review.diff_parser import DiffHunk, DiffParser, FileDiff
def test_parse_hunk_header():
"""Test parsing of diff hunk headers."""
# Standard hunk header
header = "@@ -10,5 +12,7 @@"
hunk = DiffParser._parse_hunk_header(header)
assert hunk is not None
assert hunk.old_start == 10
... | 1 | assert | numeric_literal | tests/test_diff_parser.py | test_parse_hunk_header | 24 | null | |
cased/kit | import re
import pytest
from kit.pr_review.priority_filter import (
MAJOR_SECTION_PATTERN,
MAX_LINES,
MIN_MEANINGFUL_LENGTH,
PRIORITY_HEADER_PATTERNS,
PRIORITY_SECTION_PATTERNS,
_extract_priority_level,
_filter_priority_content,
_is_major_section_header,
_is_meaningful_content,
... | "" | assert | string_literal | tests/test_priority_filtering.py | test_input_validation_none_input | TestFilterReviewByPriority | 179 | null |
cased/kit | import json
import os
import tempfile
from kit import MultiRepo, Repository
def create_test_repo(tmpdir: str, name: str, files: dict) -> str:
"""Create a test repository with given files."""
repo_path = os.path.join(tmpdir, name)
os.makedirs(repo_path, exist_ok=True)
for file_path, content in files.i... | 1 | assert | numeric_literal | tests/test_multi_repo.py | test_multi_repo_extract_all_symbols | 154 | null | |
meilisearch/meilisearch-python | from unittest.mock import patch
import pytest
import requests
from meilisearch.errors import MeilisearchApiError, MeilisearchCommunicationError
def test_create_chat_completion_basic_stream(client):
"""Test basic streaming functionality with successful response."""
dummy_lines = [
b'data: {"id":"chatc... | " world" | assert | string_literal | tests/client/test_chat_completions.py | test_create_chat_completion_basic_stream | 57 | null | |
meilisearch/meilisearch-python | import datetime
from copy import deepcopy
import pytest
import meilisearch
from meilisearch.errors import MeilisearchApiError
from tests import BASE_URL
def test_generate_tenant_token_with_search_rules(get_private_key, index_with_documents):
"""Tests create a tenant token with only search rules."""
index_wit... | "" | assert | string_literal | tests/client/test_client_tenant_token.py | test_generate_tenant_token_with_search_rules | 24 | null | |
meilisearch/meilisearch-python | import pytest
from meilisearch.errors import MeilisearchApiError
from tests.common import INDEX_UID, REMOTE_MS_1, REMOTE_MS_2
from tests.test_utils import reset_network_config
def test_multi_search_with_federation_options(client, index_with_documents):
"""Tests multi-search with federation, with federation option... | 0.99 | assert | numeric_literal | tests/client/test_client_multi_search_meilisearch.py | test_multi_search_with_federation_options | 76 | null | |
meilisearch/meilisearch-python | NEW_SYNONYMS = {"hp": ["harry potter"]}
def test_update_synonyms(empty_index):
"""Tests updating synonyms."""
index = empty_index()
response = index.update_synonyms(NEW_SYNONYMS)
update = index.wait_for_task(response.task_uid)
assert update.status == | "succeeded" | assert | string_literal | tests/settings/test_settings_synonyms_meilisearch.py | test_update_synonyms | 15 | null | |
meilisearch/meilisearch-python | NEW_RANKING_RULES = ["typo", "exactness"]
DEFAULT_RANKING_RULES = [
"words",
"typo",
"proximity",
"attributeRank",
"sort",
"wordPosition",
"exactness",
]
def test_update_ranking_rules_none(empty_index):
"""Tests updating the ranking rules at null."""
index = empty_index()
# Upda... | "succeeded" | assert | string_literal | tests/settings/test_settings_ranking_rules_meilisearch.py | test_update_ranking_rules_none | 36 | null | |
meilisearch/meilisearch-python | NEW_SEARCH_CUTOFF_MS = 150
def test_update_search_cutoff_ms(empty_index):
"""Tests updating search cutoff in ms."""
index = empty_index()
response = index.update_search_cutoff_ms(NEW_SEARCH_CUTOFF_MS)
update = index.wait_for_task(response.task_uid)
assert update.status == "succeeded"
response =... | response | assert | variable | tests/settings/test_settings_search_cutoff_meilisearch.py | test_update_search_cutoff_ms | 17 | null | |
meilisearch/meilisearch-python | from collections import Counter
import pytest
def test_custom_search_params_with_crop_marker(index_with_documents):
"""Tests search with a list of one string in query params."""
response = index_with_documents().search(
"dragon",
{
"limit": 1,
"attributesToCrop": ["over... | 1 | assert | numeric_literal | tests/index/test_index_search_meilisearch.py | test_custom_search_params_with_crop_marker | 129 | null | |
meilisearch/meilisearch-python | import pytest
from meilisearch.models.embedders import (
CompositeEmbedder,
HuggingFaceEmbedder,
OpenAiEmbedder,
PoolingType,
UserProvidedEmbedder,
)
def test_openai_embedder_format(empty_index):
"""Tests that OpenAi embedder has the required fields and proper format."""
index = empty_inde... | 0.1 | assert | numeric_literal | tests/settings/test_settings_embedders.py | test_openai_embedder_format | 79 | null | |
meilisearch/meilisearch-python | import pytest
from meilisearch.models.document import Document
def test_getattr():
document = Document({"field1": "test 1", "field2": "test 2"})
assert document.__getattr__("field1") == | "test 1" | assert | string_literal | tests/models/test_document.py | test_getattr | 17 | null | |
meilisearch/meilisearch-python | def test_facet_search_with_empty_query(index_with_documents_and_facets):
"""Tests facet search with a empty query."""
response = index_with_documents_and_facets().facet_search("genre")
assert isinstance(response, dict)
assert len(response["facetHits"]) == 4
assert response["facetHits"][0]["value"] =... | None | assert | none_literal | tests/index/test_index_facet_search_meilisearch.py | test_facet_search_with_empty_query | 19 | null | |
meilisearch/meilisearch-python | def test_facet_search_with_empty_query(index_with_documents_and_facets):
"""Tests facet search with a empty query."""
response = index_with_documents_and_facets().facet_search("genre")
assert isinstance(response, dict)
assert len(response["facetHits"]) == 4
assert response["facetHits"][0]["value"] ... | "action" | assert | string_literal | tests/index/test_index_facet_search_meilisearch.py | test_facet_search_with_empty_query | 17 | null | |
meilisearch/meilisearch-python | import pytest
from tests.common import BASE_URL, REMOTE_MS_1
from tests.test_utils import reset_network_config
@pytest.mark.usefixtures("enable_network_options")
def test_update_and_get_network_settings(client):
"""Test updating and getting network settings."""
instance_name = REMOTE_MS_1
options = {
... | options["remotes"][instance_name]["searchApiKey"] | assert | complex_expr | tests/client/test_client_sharding.py | test_update_and_get_network_settings | 27 | null | |
meilisearch/meilisearch-python | from typing import List
from meilisearch.models.index import LocalizedAttributes
NEW_LOCALIZED_ATTRIBUTES = [{"attributePatterns": ["title"], "locales": ["eng"]}]
def unpack_loc_attrs_response(response: List[LocalizedAttributes]):
return [loc_attrs.model_dump(by_alias=True) for loc_attrs in response]
def test_u... | unpack_loc_attrs_response(response) | assert | func_call | tests/settings/test_settings_localized_attributes_meilisearch.py | test_update_localized_attributes | 25 | null | |
meilisearch/meilisearch-python | from datetime import datetime
import pytest
from meilisearch.errors import MeilisearchApiError
from tests import common
def test_get_keys_default(client):
"""Tests if default keys have been generated and can be retrieved."""
keys = client.get_keys()
assert len(keys.results) >= | 2 | assert | numeric_literal | tests/client/test_client_key_meilisearch.py | test_get_keys_default | 12 | null | |
meilisearch/meilisearch-python | import base64
import json
import os
from pathlib import Path
import pytest
import requests
from meilisearch import Client
from meilisearch.errors import MeilisearchApiError
from tests import common
VOYAGE_API_KEY = os.getenv("VOYAGE_API_KEY")
INDEX_UID = "multi-modal-search-test"
EMBEDDER_NAME = "multimodal"
DATAS... | "Dumbo" | assert | string_literal | tests/client/test_multimodal.py | test_image_query | TestMultimodalSearch | 264 | null |
meilisearch/meilisearch-python | FILTERABLE_ATTRIBUTES = ["title", "release_date"]
def test_update_filterable_attributes_to_none(empty_index):
"""Tests updating the filterable attributes at null."""
index = empty_index()
# Update the settings first
response = index.update_filterable_attributes(FILTERABLE_ATTRIBUTES)
update = index... | "succeeded" | assert | string_literal | tests/settings/test_settings_filterable_attributes_meilisearch.py | test_update_filterable_attributes_to_none | 29 | null | |
meilisearch/meilisearch-python | FILTERABLE_ATTRIBUTES = ["title", "release_date"]
def test_update_filterable_attributes(empty_index):
"""Tests updating the filterable attributes."""
index = empty_index()
response = index.update_filterable_attributes(FILTERABLE_ATTRIBUTES)
index.wait_for_task(response.task_uid)
get_attributes = in... | get_attributes | assert | variable | tests/settings/test_settings_filterable_attributes_meilisearch.py | test_update_filterable_attributes | 20 | null | |
meilisearch/meilisearch-python | import pytest
from meilisearch.models.embedders import OpenAiEmbedder, UserProvidedEmbedder
def new_settings(new_embedders):
return {
"rankingRules": ["typo", "words"],
"searchableAttributes": ["title", "overview"],
"embedders": new_embedders,
}
def test_get_settings_default(empty_ind... | ["*"] | assert | collection | tests/settings/test_settings.py | test_get_settings_default | 46 | null | |
meilisearch/meilisearch-python | from datetime import datetime, timezone
import pytest
from meilisearch._utils import is_pydantic_2, iso_to_date_time
@pytest.mark.parametrize(
"iso_date, expected",
[
("2021-05-11T03:12:22.563960100Z", datetime(2021, 5, 11, 3, 12, 22, 563960)),
("2021-05-11T03:12:22.563960100+00:00", datetime... | expected | assert | variable | tests/test_utils.py | test_iso_to_date_time | 28 | null | |
meilisearch/meilisearch-python | from meilisearch.models.index import ProximityPrecision
NEW_PROXIMITY_PRECISION = ProximityPrecision.BY_ATTRIBUTE
def test_update_proximity_precision(empty_index):
"""Tests updating proximity precision."""
index = empty_index()
response = index.update_proximity_precision(NEW_PROXIMITY_PRECISION)
updat... | "succeeded" | assert | string_literal | tests/settings/test_settings_proximity_precision_meilisearch.py | test_update_proximity_precision | 17 | null | |
meilisearch/meilisearch-python | NEW_STOP_WORDS = ["of", "the"]
def test_get_stop_words_default(empty_index):
"""Tests getting stop words by default."""
response = empty_index().get_stop_words()
assert response == | [] | assert | collection | tests/settings/test_settings_stop_words_meilisearch.py | test_get_stop_words_default | 7 | null | |
meilisearch/meilisearch-python | def test_update_experimental_features(client):
"""Test updating experimental features."""
# Enable multimodal
response = client.update_experimental_features({"multimodal": True})
assert isinstance(response, dict)
assert response.get("multimodal") is | True | assert | bool_literal | tests/client/test_experimental_features.py | test_update_experimental_features | 17 | null | |
meilisearch/meilisearch-python | import pytest
from tests.common import INDEX_UID
@pytest.mark.usefixtures("enable_edit_documents_by_function")
def test_update_document_by_function(client, index_with_documents):
"""Delete the document with id and update document title"""
index_with_documents()
response = client.update_documents_by_functi... | INDEX_UID | assert | variable | tests/client/test_client_update_document_by_functions.py | test_update_document_by_function | 17 | null | |
meilisearch/meilisearch-python | from meilisearch.models.index import PrefixSearch
DEFAULT_PREFIX_SEARCH_SETTINGS = PrefixSearch.INDEXING_TIME
def test_get_prefix_search(empty_index):
response = empty_index().get_prefix_search()
assert DEFAULT_PREFIX_SEARCH_SETTINGS == | response | assert | variable | tests/settings/test_settings_prefix_search.py | test_get_prefix_search | 9 | null | |
meilisearch/meilisearch-python | from typing import List
from meilisearch.models.index import LocalizedAttributes
NEW_LOCALIZED_ATTRIBUTES = [{"attributePatterns": ["title"], "locales": ["eng"]}]
def unpack_loc_attrs_response(response: List[LocalizedAttributes]):
return [loc_attrs.model_dump(by_alias=True) for loc_attrs in response]
def test_u... | "succeeded" | assert | string_literal | tests/settings/test_settings_localized_attributes_meilisearch.py | test_update_localized_attributes | 23 | null | |
meilisearch/meilisearch-python | import pytest
from meilisearch.errors import MeilisearchApiError
from tests.common import INDEX_UID, REMOTE_MS_1, REMOTE_MS_2
from tests.test_utils import reset_network_config
def test_multi_search_with_no_value_in_federation(client, empty_index, index_with_documents):
"""Tests multi-search with federation, but n... | response | assert | variable | tests/client/test_client_multi_search_meilisearch.py | test_multi_search_with_no_value_in_federation | 46 | null | |
meilisearch/meilisearch-python | from meilisearch.models.index import TypoTolerance
DEFAULT_TYPO_TOLERANCE = {
"enabled": True,
"disableOnNumbers": False,
"minWordSizeForTypos": {
"oneTypo": 5,
"twoTypos": 9,
},
"disableOnWords": [],
"disableOnAttributes": [],
}
NEW_TYPO_TOLERANCE = {
"enabled": True,
... | response_get.model_dump(by_alias=True)[typo_tolerance] | assert | func_call | tests/settings/test_settings_typo_tolerance_meilisearch.py | test_update_typo_tolerance | 43 | null | |
meilisearch/meilisearch-python | import pytest
from tests.common import REMOTE_MS_1, REMOTE_MS_2
from tests.test_utils import reset_network_config
@pytest.mark.usefixtures("enable_network_options")
def test_configure_as_leader(client):
"""Test configuring the current instance as a Leader with one follower."""
body = {
"remotes": {
... | None | assert | none_literal | tests/client/test_client_network.py | test_configure_as_leader | 58 | null | |
meilisearch/meilisearch-python | import pytest
from meilisearch.errors import MeilisearchApiError
from tests.common import INDEX_UID, REMOTE_MS_1, REMOTE_MS_2
from tests.test_utils import reset_network_config
@pytest.mark.usefixtures("enable_network_options")
def test_multi_search_with_network(client, index_with_documents):
"""Tests multi-search... | {} | assert | collection | tests/client/test_client_multi_search_meilisearch.py | test_multi_search_with_network | 113 | null | |
meilisearch/meilisearch-python | SORTABLE_ATTRIBUTES = ["title", "release_date"]
def test_get_sortable_attributes(empty_index):
"""Tests getting the sortable attributes."""
response = empty_index().get_sortable_attributes()
assert response == | [] | assert | collection | tests/settings/test_settings_sortable_attributes_meilisearch.py | test_get_sortable_attributes | 9 | null | |
meilisearch/meilisearch-python | DEFAULT_FACET_SEARCH_SETTINGS_STATUS = True
ENABLED_FACET_SEARCH_SETTINGS_STATUS = True
DISABLED_FACET_SEARCH_SETTINGS_STATUS = False
def test_get_facet_search_settings(empty_index):
response = empty_index().get_facet_search_settings()
assert DEFAULT_FACET_SEARCH_SETTINGS_STATUS == | response | assert | variable | tests/settings/test_settings_facet_search.py | test_get_facet_search_settings | 9 | null | |
meilisearch/meilisearch-python | NEW_DICTIONARY = ["J. R. R. Tolkien", "W. E. B. Du Bois"]
def test_update_dictionary(empty_index):
"""Tests updating the user dictionary."""
index = empty_index()
task = index.update_dictionary(NEW_DICTIONARY)
task = index.wait_for_task(task.task_uid)
assert task.status == | "succeeded" | assert | string_literal | tests/settings/test_settings_dictionary_meilisearch.py | test_update_dictionary | 15 | null | |
meilisearch/meilisearch-python | import pytest
from meilisearch.models.embedders import (
CompositeEmbedder,
HuggingFaceEmbedder,
OpenAiEmbedder,
PoolingType,
UserProvidedEmbedder,
)
def test_rest_embedder_format(empty_index):
"""Tests that Rest embedder has the required fields and proper format."""
index = empty_index()
... | 512 | assert | numeric_literal | tests/settings/test_settings_embedders.py | test_rest_embedder_format | 164 | null | |
meilisearch/meilisearch-python | import datetime
from copy import deepcopy
import pytest
import meilisearch
from meilisearch.errors import MeilisearchApiError
from tests import BASE_URL
def test_generate_tenant_token_no_api_key(client, get_private_key):
# Make a copy of the client so we don't change the value in the session scoped fixture as th... | str(exc.value) | assert | func_call | tests/client/test_client_tenant_token.py | test_generate_tenant_token_no_api_key | 69 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.