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 |
|---|---|---|---|---|---|---|---|---|---|
gotalab/skillport | from pathlib import Path
import pytest
from skillport.shared.config import SKILLPORT_HOME, Config
class TestConfigProviderValidation:
def test_openai_with_key_ok(self, monkeypatch):
"""provider=openai with OPENAI_API_KEY → ok."""
monkeypatch.setenv("SKILLPORT_EMBEDDING_PROVIDER", "openai")
... | "sk-test-key" | assert | string_literal | tests/unit/test_config.py | test_openai_with_key_ok | TestConfigProviderValidation | 168 | null |
gotalab/skillport | from pathlib import Path
from hypothesis import given, settings
from hypothesis import strategies as st
from skillport.modules.indexing.internal.lancedb import IndexStore
from skillport.modules.indexing.internal.search_service import SearchService
from skillport.shared.config import Config
from skillport.shared.utils... | expected | assert | variable | tests/unit/test_normalization_and_threshold.py | test_category_tag_normalization | 66 | null | |
gotalab/skillport | from pathlib import Path
import pytest
from skillport.shared.config import SKILLPORT_HOME, Config
class TestConfigDefaults:
def test_search_limit_default(self, monkeypatch):
"""SKILLPORT_SEARCH_LIMIT defaults to 10."""
monkeypatch.delenv("SKILLPORT_SEARCH_LIMIT", raising=False)
cfg = Con... | 10 | assert | numeric_literal | tests/unit/test_config.py | test_search_limit_default | TestConfigDefaults | 41 | null |
gotalab/skillport | import base64
from pathlib import Path
import pytest
from fastmcp.client import Client
from skillport.interfaces.mcp.server import create_mcp_server
from skillport.modules.indexing import build_index
from skillport.shared.config import Config
def _create_test_skill(skills_dir: Path, skill_id: str, content: str = "Te... | 1 | assert | numeric_literal | tests/integration/test_mcp_server.py | test_search_skills_empty_query_lists_all | TestLocalMode | 97 | null |
gotalab/skillport | from pathlib import Path
from skillport.interfaces.cli.commands.meta import _write_frontmatter
from skillport.shared.utils import parse_frontmatter
def test_write_frontmatter_is_readable_yaml(tmp_path: Path):
skill_md = tmp_path / "SKILL.md"
meta = {
"name": "anthropic-design",
"description": ... | meta | assert | variable | tests/unit/test_meta_frontmatter_format.py | test_write_frontmatter_is_readable_yaml | 32 | null | |
gotalab/skillport | from pathlib import Path
from unittest.mock import patch
from skillport.modules.indexing.internal.lancedb import IndexStore
from skillport.shared.config import Config
def _make_store(tmp_path: Path):
cfg = Config(skills_dir=tmp_path / "skills", db_path=tmp_path / "db.lancedb")
with patch(
"skillport.m... | "hash_changed" | assert | string_literal | tests/unit/test_index_state.py | test_state_detects_change | 61 | null | |
gotalab/skillport | from skillport.modules.skills.internal import origin as origin_mod
from skillport.shared.config import Config
def test_record_and_remove_origin(tmp_path):
cfg = Config(meta_dir=tmp_path)
origin_mod.record_origin("abc", {"source": "local"}, config=cfg)
path = tmp_path / "origins.json"
assert path.exist... | "{}" | assert | string_literal | tests/unit/test_origin.py | test_record_and_remove_origin | 17 | null | |
gotalab/skillport | from skillport.modules.skills.internal import (
compute_content_hash,
get_all_origins,
get_origin,
migrate_origin_v2,
prune_orphan_origins,
record_origin,
update_origin,
)
from skillport.shared.config import Config
class TestUpdateOrigin:
def test_update_origin_adds_history_entry(self,... | "old" | assert | string_literal | tests/unit/test_origin_v2.py | test_update_origin_adds_history_entry | TestUpdateOrigin | 234 | null |
gotalab/skillport | import io
import tarfile
from pathlib import Path
import pytest
from skillport.modules.skills.internal.github import (
GITHUB_URL_RE,
ParsedGitHubURL,
extract_tarball,
parse_github_url,
)
def _make_tar(tmp_path: Path, structure: dict) -> Path:
"""Create a tar.gz with given structure under root fo... | "main" | assert | string_literal | tests/unit/test_github_source.py | test_parse_github_url_root_defaults_to_main | 290 | null | |
gotalab/skillport | import zipfile
import pytest
from skillport.modules.skills.internal.zip_handler import (
MAX_EXTRACTED_BYTES,
MAX_FILE_BYTES,
MAX_ZIP_FILES,
extract_zip,
)
class TestExtractZipEdgeCases:
def test_nonexistent_zip_raises(self, tmp_path):
"""Non-existent zip file raises FileNotFoundError.""... | FileNotFoundError) | pytest.raises | variable | tests/unit/test_zip_handler.py | test_nonexistent_zip_raises | TestExtractZipEdgeCases | 248 | null |
gotalab/skillport | import base64
from pathlib import Path
import pytest
from fastmcp.client import Client
from skillport.interfaces.mcp.server import create_mcp_server
from skillport.modules.indexing import build_index
from skillport.shared.config import Config
def _create_test_skill(skills_dir: Path, skill_id: str, content: str = "Te... | result.data | assert | complex_expr | tests/integration/test_mcp_server.py | test_search_skills_returns_results | TestLocalMode | 89 | null |
gotalab/skillport | from pathlib import Path
from unittest.mock import patch
from skillport.modules.indexing.internal.lancedb import IndexStore
from skillport.shared.config import Config
def _make_store(tmp_path: Path):
cfg = Config(skills_dir=tmp_path / "skills", db_path=tmp_path / "db.lancedb")
with patch(
"skillport.m... | False | assert | bool_literal | tests/unit/test_index_state.py | test_state_written_and_skipped_when_unchanged | 43 | null | |
gotalab/skillport | from pathlib import Path
from types import SimpleNamespace
from unittest.mock import patch
import pytest
from skillport.modules.indexing import search as idx_search
from skillport.modules.skills import read_skill_file, search_skills
from skillport.shared.config import Config
def _make_config(tmp_path: Path) -> Confi... | binary_content | assert | variable | tests/integration/test_search_and_tools_integration.py | test_read_skill_file_guards_traversal_and_supports_binary | 216 | null | |
gotalab/skillport | import json
from dataclasses import dataclass
from pathlib import Path
import pytest
from typer.testing import CliRunner
from skillport.interfaces.cli.app import app
runner = CliRunner()
def _create_skill(path: Path, name: str, description: str = "Test skill") -> Path:
"""Helper to create a valid skill."""
... | 2 | assert | numeric_literal | tests/integration/test_cli_commands.py | test_list_with_limit | TestListCommand | 89 | null |
gotalab/skillport | import sys
from pathlib import Path
import pytest
from skillport.interfaces.cli.config import (
ProjectConfig,
load_project_config,
)
class TestProjectConfigDefault:
def test_default_source(self):
"""Default source is 'default'."""
config = ProjectConfig.default()
assert config... | "default" | assert | string_literal | tests/unit/test_project_config.py | test_default_source | TestProjectConfigDefault | 191 | null |
gotalab/skillport | from pathlib import Path
from skillport.interfaces.cli.commands.doc import (
MARKER_END,
MARKER_START,
_truncate_description,
generate_skills_block,
update_agents_md,
)
from skillport.modules.skills import SkillSummary
class TestTruncateDescription:
def test_long_description_truncated(self):
... | 50 | assert | numeric_literal | tests/unit/test_doc.py | test_long_description_truncated | TestTruncateDescription | 31 | null |
gotalab/skillport | from skillport.modules.skills.internal import (
compute_content_hash,
get_all_origins,
get_origin,
migrate_origin_v2,
prune_orphan_origins,
record_origin,
update_origin,
)
from skillport.shared.config import Config
class TestComputeContentHash:
def test_compute_hash_changes_with_other_... | hash2 | assert | variable | tests/unit/test_origin_v2.py | test_compute_hash_changes_with_other_files | TestComputeContentHash | 91 | null |
gotalab/skillport | import json
from dataclasses import dataclass
from pathlib import Path
import pytest
from typer.testing import CliRunner
from skillport.interfaces.cli.app import app
runner = CliRunner()
def _create_skill(path: Path, name: str, description: str = "Test skill") -> Path:
"""Helper to create a valid skill."""
... | 0 | assert | numeric_literal | tests/integration/test_cli_commands.py | test_list_empty_skills_dir | TestListCommand | 53 | null |
gotalab/skillport | import base64
from unittest.mock import patch
import pytest
from skillport.interfaces.mcp.instructions import build_xml_instructions
from skillport.interfaces.mcp.server import _get_registered_tools_list
from skillport.modules.skills.public.types import FileContent
from skillport.shared.config import Config
class Te... | result | assert | variable | tests/unit/test_transport_mode.py | test_remote_mode_instructions_has_read_skill_file | TestDynamicInstructions | 71 | null |
gotalab/skillport | import zipfile
import pytest
from skillport.modules.skills.internal.zip_handler import (
MAX_EXTRACTED_BYTES,
MAX_FILE_BYTES,
MAX_ZIP_FILES,
extract_zip,
)
class TestExtractZipSecurity:
def test_rejects_oversized_file(self, tmp_path):
"""Zip with oversized single file is rejected."""
... | ValueError, match="File too large") | pytest.raises | complex_expr | tests/unit/test_zip_handler.py | test_rejects_oversized_file | TestExtractZipSecurity | 139 | null |
gotalab/skillport | from unittest.mock import patch
from skillport.interfaces.mcp.instructions import (
_escape_xml,
build_xml_instructions,
)
from skillport.shared.config import Config
class TestBuildXmlInstructionsStructure:
def test_has_usage_section(self):
"""Output has <usage> section."""
config = Confi... | result | assert | variable | tests/unit/test_xml_instructions.py | test_has_usage_section | TestBuildXmlInstructionsStructure | 62 | null |
gotalab/skillport | import base64
from pathlib import Path
import pytest
from fastmcp.client import Client
from skillport.interfaces.mcp.server import create_mcp_server
from skillport.modules.indexing import build_index
from skillport.shared.config import Config
def _create_test_skill(skills_dir: Path, skill_id: str, content: str = "Te... | tool_names | assert | variable | tests/integration/test_mcp_server.py | test_list_tools_returns_two_tools | TestLocalMode | 83 | null |
gotalab/skillport | from pathlib import Path
import pytest
from skillport.shared.config import SKILLPORT_HOME, Config
class TestConfigProviderValidation:
def test_openai_with_key_ok(self, monkeypatch):
"""provider=openai with OPENAI_API_KEY → ok."""
monkeypatch.setenv("SKILLPORT_EMBEDDING_PROVIDER", "openai")
... | "openai" | assert | string_literal | tests/unit/test_config.py | test_openai_with_key_ok | TestConfigProviderValidation | 167 | null |
gotalab/skillport | from pathlib import Path
import pytest
from skillport.modules.skills.internal.manager import (
BUILTIN_SKILLS,
_validate_skill_file,
add_builtin,
add_local,
detect_skills,
)
from skillport.shared.config import Config
def _create_skill(path: Path, name: str, description: str = "Test description") ... | "zip" | assert | string_literal | tests/unit/test_add_logic.py | test_add_single_skill_from_zip | TestAddSkillFromZip | 527 | null |
gotalab/skillport | import pytest
from skillport.modules.skills.internal.validation import (
ALLOWED_FRONTMATTER_KEYS,
COMPATIBILITY_MAX_LENGTH,
DESCRIPTION_MAX_LENGTH,
NAME_MAX_LENGTH,
RESERVED_WORDS,
SKILL_LINE_THRESHOLD,
validate_skill_record,
)
class TestValidationFatal:
def test_name_required(self):... | 1 | assert | numeric_literal | tests/unit/test_validation_rules.py | test_name_required | TestValidationFatal | 23 | null |
gotalab/skillport | from pathlib import Path
import pytest
from skillport.shared.config import SKILLPORT_HOME, Config
class TestConfigImmutability:
def test_with_overrides_creates_new(self, monkeypatch, tmp_path):
"""with_overrides creates new Config without mutating original."""
cfg1 = Config()
cfg2 = cfg1... | cfg2.skills_dir | assert | complex_expr | tests/unit/test_config.py | test_with_overrides_creates_new | TestConfigImmutability | 198 | null |
gotalab/skillport | import json
from dataclasses import dataclass
from pathlib import Path
import pytest
from typer.testing import CliRunner
from skillport.interfaces.cli.app import app
runner = CliRunner()
def _create_skill(path: Path, name: str, description: str = "Test skill") -> Path:
"""Helper to create a valid skill."""
... | 1 | assert | numeric_literal | tests/integration/test_cli_commands.py | test_list_json_output | TestListCommand | 78 | null |
gotalab/skillport | import io
import tarfile
from pathlib import Path
import pytest
from skillport.modules.skills.internal.github import (
GITHUB_URL_RE,
ParsedGitHubURL,
extract_tarball,
parse_github_url,
)
def _make_tar(tmp_path: Path, structure: dict) -> Path:
"""Create a tar.gz with given structure under root fo... | "" | assert | string_literal | tests/unit/test_github_source.py | test_parse_github_url_root_defaults_to_main | 291 | null | |
gotalab/skillport | from skillport.modules.skills.internal import (
compute_content_hash,
get_all_origins,
get_origin,
migrate_origin_v2,
prune_orphan_origins,
record_origin,
update_origin,
)
from skillport.shared.config import Config
class TestMigrateOriginV2:
def test_migrate_preserves_existing_v2_field... | True | assert | bool_literal | tests/unit/test_origin_v2.py | test_migrate_preserves_existing_v2_fields | TestMigrateOriginV2 | 60 | null |
gotalab/skillport | from pathlib import Path
import yaml
from skillport.interfaces.cli.commands.init import (
DEFAULT_INSTRUCTIONS,
DEFAULT_SKILLS_DIRS,
_create_skillportrc,
)
class TestCreateSkillportrc:
def test_writes_instructions(self, tmp_path: Path):
"""Writes instructions list to file."""
rc_path... | ["AGENTS.md"] | assert | collection | tests/unit/test_init_command.py | test_writes_instructions | TestCreateSkillportrc | 49 | null |
gotalab/skillport | import base64
from unittest.mock import patch
import pytest
from skillport.interfaces.mcp.instructions import build_xml_instructions
from skillport.interfaces.mcp.server import _get_registered_tools_list
from skillport.modules.skills.public.types import FileContent
from skillport.shared.config import Config
class Te... | tools | assert | variable | tests/unit/test_transport_mode.py | test_local_mode_two_tools | TestRegisteredToolsList | 21 | null |
gotalab/skillport | import io
import tarfile
from pathlib import Path
import pytest
from skillport.modules.skills.internal.github import (
GITHUB_URL_RE,
ParsedGitHubURL,
extract_tarball,
parse_github_url,
)
def _make_tar(tmp_path: Path, structure: dict) -> Path:
"""Create a tar.gz with given structure under root fo... | "repo" | assert | string_literal | tests/unit/test_github_source.py | test_parse_github_url_root_defaults_to_main | 289 | null | |
gotalab/skillport | import zipfile
import pytest
from skillport.modules.skills.internal.zip_handler import (
MAX_EXTRACTED_BYTES,
MAX_FILE_BYTES,
MAX_ZIP_FILES,
extract_zip,
)
class TestExtractZipSecurity:
def test_rejects_oversized_total(self, tmp_path):
"""Zip with total size over limit is rejected."""
... | ValueError, match="exceeds limit") | pytest.raises | complex_expr | tests/unit/test_zip_handler.py | test_rejects_oversized_total | TestExtractZipSecurity | 152 | null |
gotalab/skillport | from pathlib import Path
from types import SimpleNamespace
from unittest.mock import patch
import pytest
from skillport.modules.indexing import search as idx_search
from skillport.modules.skills import read_skill_file, search_skills
from skillport.shared.config import Config
def _make_config(tmp_path: Path) -> Confi... | "base64" | assert | string_literal | tests/integration/test_search_and_tools_integration.py | test_read_skill_file_guards_traversal_and_supports_binary | 215 | null | |
gotalab/skillport | from pathlib import Path
from unittest.mock import patch
from skillport.modules.indexing.internal.lancedb import IndexStore
from skillport.shared.config import Config
def _make_store(tmp_path: Path):
cfg = Config(skills_dir=tmp_path / "skills", db_path=tmp_path / "db.lancedb")
with patch(
"skillport.m... | "unchanged" | assert | string_literal | tests/unit/test_index_state.py | test_state_written_and_skipped_when_unchanged | 44 | null | |
gotalab/skillport | from pathlib import Path
import pytest
from skillport.shared.config import SKILLPORT_HOME, Config
class TestConfigEnvironment:
def test_search_limit_from_env(self, monkeypatch):
"""SKILLPORT_SEARCH_LIMIT loaded from environment."""
monkeypatch.setenv("SKILLPORT_SEARCH_LIMIT", "50")
cfg =... | 50 | assert | numeric_literal | tests/unit/test_config.py | test_search_limit_from_env | TestConfigEnvironment | 77 | null |
gotalab/skillport | from pathlib import Path
import yaml
from skillport.interfaces.cli.commands.init import (
DEFAULT_INSTRUCTIONS,
DEFAULT_SKILLS_DIRS,
_create_skillportrc,
)
class TestDefaultConstants:
def test_default_skills_dirs_has_options(self):
"""DEFAULT_SKILLS_DIRS has multiple options."""
ass... | 2 | assert | numeric_literal | tests/unit/test_init_command.py | test_default_skills_dirs_has_options | TestDefaultConstants | 80 | null |
gotalab/skillport | import io
import tarfile
from pathlib import Path
import pytest
from skillport.modules.skills.internal.github import (
GITHUB_URL_RE,
ParsedGitHubURL,
extract_tarball,
parse_github_url,
)
def _make_tar(tmp_path: Path, structure: dict) -> Path:
"""Create a tar.gz with given structure under root fo... | "user" | assert | string_literal | tests/unit/test_github_source.py | test_parse_github_url_root_defaults_to_main | 288 | null | |
gotalab/skillport | from pathlib import Path
import pytest
from skillport.modules.skills.internal.manager import (
BUILTIN_SKILLS,
_validate_skill_file,
add_builtin,
add_local,
detect_skills,
)
from skillport.shared.config import Config
def _create_skill(path: Path, name: str, description: str = "Test description") ... | 2 | assert | numeric_literal | tests/unit/test_add_logic.py | test_mixed_new_and_existing | TestAddLocalOverwrite | 269 | null |
gotalab/skillport | from pathlib import Path
import yaml
from skillport.interfaces.cli.commands.init import (
DEFAULT_INSTRUCTIONS,
DEFAULT_SKILLS_DIRS,
_create_skillportrc,
)
class TestCreateSkillportrc:
def test_includes_comments(self, tmp_path: Path):
"""File includes helpful comments."""
rc_path = t... | content | assert | variable | tests/unit/test_init_command.py | test_includes_comments | TestCreateSkillportrc | 60 | null |
gotalab/skillport | from pathlib import Path
from types import SimpleNamespace
from unittest.mock import patch
import pytest
from skillport.modules.indexing import search as idx_search
from skillport.modules.skills import read_skill_file, search_skills
from skillport.shared.config import Config
def _make_config(tmp_path: Path) -> Confi... | PermissionError) | pytest.raises | variable | tests/integration/test_search_and_tools_integration.py | test_read_skill_file_guards_traversal_and_supports_binary | 208 | null | |
gotalab/skillport | import sys
from pathlib import Path
import pytest
from skillport.interfaces.cli.config import (
ProjectConfig,
load_project_config,
)
class TestProjectConfigFromSkillportrc:
def test_loads_skills_dir(self, tmp_path: Path):
"""Loads skills_dir from .skillportrc."""
rc_path = tmp_path / ".... | None | assert | none_literal | tests/unit/test_project_config.py | test_loads_skills_dir | TestProjectConfigFromSkillportrc | 24 | null |
gotalab/skillport | import base64
from pathlib import Path
import pytest
from fastmcp.client import Client
from skillport.interfaces.mcp.server import create_mcp_server
from skillport.modules.indexing import build_index
from skillport.shared.config import Config
def _create_test_skill(skills_dir: Path, skill_id: str, content: str = "Te... | 0 | assert | numeric_literal | tests/integration/test_mcp_server.py | test_search_skills_returns_results | TestLocalMode | 90 | null |
gotalab/skillport | from pathlib import Path
import yaml
from skillport.interfaces.cli.commands.init import (
DEFAULT_INSTRUCTIONS,
DEFAULT_SKILLS_DIRS,
_create_skillportrc,
)
class TestDefaultConstants:
def test_default_instructions_has_agents_md(self):
"""DEFAULT_INSTRUCTIONS includes AGENTS.md."""
na... | names | assert | variable | tests/unit/test_init_command.py | test_default_instructions_has_agents_md | TestDefaultConstants | 94 | null |
gotalab/skillport | from pathlib import Path
from skillport.modules.skills import add_skill
from skillport.shared.config import Config
def _write_skill(dir_path: Path, dir_name: str, skill_name: str) -> Path:
skill_dir = dir_path / dir_name
skill_dir.mkdir(parents=True, exist_ok=True)
(skill_dir / "SKILL.md").write_text(
... | result.added | assert | complex_expr | tests/unit/test_add_skill_cleanup.py | test_prefetched_dir_cleanup_after_rename | 34 | null | |
gotalab/skillport | import base64
from unittest.mock import patch
import pytest
from skillport.interfaces.mcp.instructions import build_xml_instructions
from skillport.interfaces.mcp.server import _get_registered_tools_list
from skillport.modules.skills.public.types import FileContent
from skillport.shared.config import Config
class Te... | remote | assert | variable | tests/unit/test_transport_mode.py | test_instructions_workflow_differs_by_mode | TestDynamicInstructions | 89 | null |
gotalab/skillport | import json
from pathlib import Path
import pytest
from typer.testing import CliRunner
from skillport.interfaces.cli.app import app
from skillport.shared.utils import parse_frontmatter
runner = CliRunner()
def _create_skill_with_frontmatter(
skills_dir: Path,
name: str,
*,
description: str = "Test s... | 0 | assert | numeric_literal | tests/integration/test_cli_meta_commands.py | test_set_creates_metadata_block | TestMetaSet | 47 | null |
gotalab/skillport | import zipfile
import pytest
from skillport.modules.skills.internal.zip_handler import (
MAX_EXTRACTED_BYTES,
MAX_FILE_BYTES,
MAX_ZIP_FILES,
extract_zip,
)
class TestExtractZipSecurity:
def test_rejects_path_traversal(self, tmp_path):
"""Zip with path traversal is rejected."""
zi... | ValueError, match="Path traversal") | pytest.raises | complex_expr | tests/unit/test_zip_handler.py | test_rejects_path_traversal | TestExtractZipSecurity | 88 | null |
gotalab/skillport | import base64
from unittest.mock import patch
import pytest
from skillport.interfaces.mcp.instructions import build_xml_instructions
from skillport.interfaces.mcp.server import _get_registered_tools_list
from skillport.modules.skills.public.types import FileContent
from skillport.shared.config import Config
class Te... | "Hello, World!" | assert | string_literal | tests/unit/test_transport_mode.py | test_text_file_returns_utf8 | TestReadSkillFileBinarySupport | 169 | null |
gotalab/skillport | from skillport.modules.skills.internal import (
compute_content_hash,
get_all_origins,
get_origin,
migrate_origin_v2,
prune_orphan_origins,
record_origin,
update_origin,
)
from skillport.shared.config import Config
class TestMigrateOriginV2:
def test_migrate_adds_new_fields(self):
... | [] | assert | collection | tests/unit/test_origin_v2.py | test_migrate_adds_new_fields | TestMigrateOriginV2 | 40 | null |
gotalab/skillport | import zipfile
import pytest
from skillport.modules.skills.internal.zip_handler import (
MAX_EXTRACTED_BYTES,
MAX_FILE_BYTES,
MAX_ZIP_FILES,
extract_zip,
)
class TestExtractZipEdgeCases:
def test_empty_zip(self, tmp_path):
"""Empty zip is handled gracefully."""
zip_path = tmp_pat... | 0 | assert | numeric_literal | tests/unit/test_zip_handler.py | test_empty_zip | TestExtractZipEdgeCases | 179 | null |
gotalab/skillport | from pathlib import Path
from types import SimpleNamespace
from unittest.mock import patch
import pytest
from skillport.modules.indexing import search as idx_search
from skillport.modules.skills import read_skill_file, search_skills
from skillport.shared.config import Config
def _make_config(tmp_path: Path) -> Confi... | "hello" | assert | string_literal | tests/integration/test_search_and_tools_integration.py | test_read_skill_file_guards_traversal_and_supports_binary | 220 | null | |
gotalab/skillport | import base64
from pathlib import Path
import pytest
from fastmcp.client import Client
from skillport.interfaces.mcp.server import create_mcp_server
from skillport.modules.indexing import build_index
from skillport.shared.config import Config
def _create_test_skill(skills_dir: Path, skill_id: str, content: str = "Te... | "test-skill" | assert | string_literal | tests/integration/test_mcp_server.py | test_load_skill_returns_details | TestLocalMode | 103 | null |
gotalab/skillport | import pytest
from skillport.shared.config import Config
def test_openai_requires_key(monkeypatch):
"""provider=openai without key should fail fast."""
monkeypatch.delenv("OPENAI_API_KEY", raising=False)
with pytest.raises( | ValueError) | pytest.raises | variable | tests/unit/test_settings_fail_fast.py | test_openai_requires_key | 9 | null | |
tfeldmann/organize | from conftest import read_files
from organize import Config
def test_shell(tmp_path, testoutput):
(tmp_path / "test.txt").touch()
Config.from_string(
f"""
rules:
- locations: '{tmp_path}'
actions:
- shell: 'touch {{path}}.bak'
"""
).execute(simul... | { "test.txt": "", "test.txt.bak": "", } | assert | collection | tests/actions/test_shell.py | test_shell | 16 | null | |
tfeldmann/organize | from pathlib import Path
from conftest import make_files
from organize import Config
from organize.filters.hash import hash, hash_first_chunk
def test_full_hash(fs):
r"""
Reference hashsums:
```sh
python3 -c 'from pathlib import Path; Path("hello.txt").write_text("Hello world")'
md5 hello.txt &&... | "7b502c3a1f48c8609ae212cdfb639dee39673f5e" | assert | string_literal | tests/filters/test_hash.py | test_full_hash | 23 | null | |
tfeldmann/organize | from pathlib import Path
from conftest import make_files
from organize import Config
def test_symlink(fs):
make_files({"file.txt": "Content"}, "test")
Config.from_string(
"""
rules:
- locations: /test
actions:
- symlink: /other/
"""
).execute(si... | "Content" | assert | string_literal | tests/actions/test_symlink.py | test_symlink | 20 | null | |
tfeldmann/organize | from pathlib import Path
from conftest import make_files
from organize import Config
from organize.filters.hash import hash, hash_first_chunk
def test_full_hash(fs):
r"""
Reference hashsums:
```sh
python3 -c 'from pathlib import Path; Path("hello.txt").write_text("Hello world")'
md5 hello.txt &&... | "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c" | assert | string_literal | tests/filters/test_hash.py | test_full_hash | 24 | null | |
tfeldmann/organize | from pathlib import Path
from conftest import make_files, read_files
from organize.actions.common.target_path import prepare_target_path, user_wants_a_folder
def test_prepare_target_path(fs):
# simulate
assert (
prepare_target_path(
src_name="dst.txt",
dst="/test/",
... | {} | assert | collection | tests/actions/test_common.py | test_prepare_target_path | 48 | null | |
tfeldmann/organize | from conftest import make_files, read_files
from organize import Config
def test_rename_folders(fs):
files = {
"[DVD] Best Of Video 1080 [1080p]": {
"[DVD] Best Of Video 1080 [1080p]": "",
"Metadata": "",
},
"[DVD] This Is A Title [1080p]": {
"[DVD] This... | { "Best_Of_Video_1080": { "[DVD] Best Of Video 1080 [1080p]": "", "Metadata": "", }, "This_Is_A_Title": { "[DVD] This Is A Title [1080p]": "", "Metadata": "", }, } | assert | collection | tests/actions/test_rename.py | test_rename_folders | 67 | null | |
tfeldmann/organize | from collections import Counter
from datetime import datetime
from conftest import make_files
from organize import Config
def test_echo_basic(testoutput):
Config.from_string(
"""
rules:
- actions:
- echo: "Hello World"
"""
).execute(simulate=False, output=testo... | ["Hello World"] | assert | collection | tests/actions/test_echo.py | test_echo_basic | 17 | null | |
tfeldmann/organize | from pathlib import Path
from conftest import make_files
from organize import Config
def test_multiple_pathes_single_location(fs, testoutput):
make_files(["foo.txt", "bar.txt"], "/test")
make_files(["foo.txt", "bar.txt"], "/test2")
Config.from_string(
"""
rules:
- locations:
... | ["bar.txt", "foo.txt", "bar.txt", "foo.txt"] | assert | collection | tests/core/test_location.py | test_multiple_pathes_single_location | 69 | null | |
tfeldmann/organize | from conftest import make_files, read_files
from organize import Config
def test_mimetype(fs):
make_files({"test.pdf": "", "other.jpg": ""}, "test")
Config.from_string(
"""
rules:
- locations: /test
filters:
- mimetype
actions:
- mo... | { "application": { "pdf": { "test.pdf": "", }, }, "image": { "jpeg": { "other.jpg": "", }, }, } | assert | collection | tests/filters/test_mimetype.py | test_mimetype | 18 | null | |
tfeldmann/organize | from conftest import make_files, read_files
from organize import Config
structure = {
"file1.txt": "",
"file2.txt": "",
"folder1": {
"folder2": {
"file1.2.1.txt": "",
"file1.2.2.txt": "",
},
"file1.1.txt": "",
"file1.2.txt": "",
},
}
def test_pa... | { "test": { "file1.txt": "", "file2.txt": "", }, "folder1": { "file1.1.txt": "", "file1.2.txt": "", }, "folder2": { "file1.2.1.txt": "", "file1.2.2.txt": "", }, } | assert | collection | tests/combined/test_keep_folder_structure.py | test_parent_folder_only | 33 | null | |
tfeldmann/organize | import sys
from organize.utils import (
ChangeDetector,
deep_merge,
deep_merge_inplace,
has_executable,
)
def test_inserts_new_keys():
"""Will it insert new keys by default?"""
a = {"a": 1, "b": {"b1": 2, "b2": 3}}
b = {"a": 1, "b": {"b1": 4, "b3": 5}, "c": 6}
assert deep_merge(a, b)[... | 6 | assert | numeric_literal | tests/test_utils.py | test_inserts_new_keys | 60 | null | |
tfeldmann/organize | import sys
import pytest
from organize import Config
from organize.filters.macos_tags import list_tags, matches_tags
@pytest.mark.skipif(sys.platform != "darwin", reason="runs only on macOS")
def test_macos_filter(tmp_path, testoutput):
import macos_tags
testdir = tmp_path / "test"
testdir.mkdir()
... | ["Urgent (green)"] | assert | collection | tests/filters/test_macos_tags.py | test_macos_filter | 43 | null | |
tfeldmann/organize | from pathlib import Path
from conftest import make_files
from organize import Config
def test_multiple_pathes(fs, testoutput):
make_files(["foo.txt", "bar.txt"], "/test")
make_files(["foo.txt", "bar.txt"], "/test2")
Config.from_string(
"""
rules:
- locations:
- /te... | ["bar.txt", "foo.txt"] * 2 | assert | collection | tests/core/test_location.py | test_multiple_pathes | 52 | null | |
tfeldmann/organize | from pathlib import Path
import pytest
from conftest import make_files, read_files
from organize import Config
from organize.utils import normalize_unicode
@pytest.mark.parametrize("a, b", CONFUSABLES)
def test_normalization_regex(fs, a, b):
make_files({f"{a}.txt": ""}, "test")
config = f"""
rules:
... | {"found-regex.txt": ""} | assert | collection | tests/core/test_unicode.py | test_normalization_regex | 93 | null | |
tfeldmann/organize | import pytest
from conftest import make_files, read_files
from organize import Config
from organize.filters import Size
def test_size_zero(fs):
make_files(["1", "2", "3"], "test")
config = """
rules:
- locations: "test"
filters:
- size: 0
actions:
- ... | {} | assert | collection | tests/filters/test_size.py | test_size_zero | 47 | null | |
tfeldmann/organize | from pathlib import Path
import pytest
from conftest import make_files
from organize import Config
from organize.filters.extension import Extension
@pytest.mark.parametrize(
"path,match,suffix",
(
("/somefile.pdf", True, "pdf"),
("/home/test/somefile.pdf.jpeg", False, "jpeg"),
("/home... | match | assert | variable | tests/filters/test_extension.py | test_extension | 23 | null | |
tfeldmann/organize | import re
import pytest
from conftest import ORGANIZE_DIR
from organize import Config
from organize.registry import ACTIONS, FILTERS
DOCS_DIR = ORGANIZE_DIR / "docs"
RE_CONFIG = re.compile(r"```yaml\n(?P<config>rules:(?:.*?\n)+?)```", re.MULTILINE)
def _list_examples():
for f in DOCS_DIR.rglob("*.md"):
... | action_docs | assert | variable | tests/test_docs.py | test_all_actions_documented | 56 | null | |
tfeldmann/organize | import pytest
from conftest import make_files, read_files
from organize.config import Config
def test_move_onto_itself(fs):
FILES = {
"test.txt": "",
"file.txt": "Hello world\nAnother line",
"another.txt": "",
"folder": {
"x.txt": "",
},
}
make_files(FIL... | FILES | assert | variable | tests/actions/test_move.py | test_move_onto_itself | 24 | null | |
tfeldmann/organize | from pathlib import Path
from conftest import make_files, read_files
from organize.actions.common.target_path import prepare_target_path, user_wants_a_folder
def test_prepare_folder_target_advanced(fs):
assert | Path("/some/test/folder/dst").resolve() | assert | func_call | tests/actions/test_common.py | test_prepare_folder_target_advanced | 52 | null | |
tfeldmann/organize | from pathlib import Path
import pytest
from conftest import make_files, read_files
from organize.actions.common.conflict import next_free_name, resolve_conflict
from organize.output import JSONL
from organize.resource import Resource
from organize.template import Template
def test_conflicting_folders(fs):
make_f... | Path("/test/dir1/sub1 2") | assert | func_call | tests/actions/test_conflict_resolution.py | test_conflicting_folders | 103 | null | |
tfeldmann/organize | from pathlib import Path
import pytest
from conftest import ORGANIZE_DIR
from pyfakefs.fake_filesystem import FakeFilesystem
from organize import Config
from organize.filters.exif import matches_tags
def images_folder(fs: FakeFilesystem):
RESOURCE_DIR = str(ORGANIZE_DIR / "tests" / "resources" / "images-with-exi... | "2: NIKON D3200" | assert | string_literal | tests/filters/test_exif.py | test_exif_filter_by_cam | 84 | null | |
tfeldmann/organize | from collections import Counter
from pathlib import Path
import pytest
from conftest import equal_items, make_files
from pyfakefs.fake_filesystem import FakeFilesystem
from organize.walker import Walker
def counter(items):
return Counter(str(x) for x in items)
def test_order(fs):
make_files(
{
... | [ Path("/test/1989/A"), Path("/test/1989/B"), Path("/test/1989/C"), Path("/test/1989/D"), Path("/test/2000/A/1"), Path("/test/2000/A/2"), Path("/test/2000/B/1"), Path("/test/2000/B/2"), Path("/test/2024/001"), Path("/test/2024/002"), Path("/test/2024/003"), Path("/test/2024/004"), ] | assert | collection | tests/core/test_walker.py | test_order | 161 | null | |
tfeldmann/organize | import sys
from pathlib import Path
import pytest
from organize import Config
from organize.filters.macos_tags import list_tags
@pytest.mark.skipif(sys.platform != "darwin", reason="runs only on macOS")
def test_macos_action(tmp_path: Path):
(tmp_path / "file.txt").touch()
(tmp_path / "test.txt").touch()
... | ["test (red)"] | assert | collection | tests/actions/test_macos_tags.py | test_macos_action | 28 | null | |
tfeldmann/organize | from pathlib import Path
import pytest
from conftest import make_files, read_files
from organize import Config
from organize.utils import normalize_unicode
@pytest.mark.parametrize("a, b", CONFUSABLES)
def test_normalize(a, b):
assert a != b
assert normalize_unicode(a) == | normalize_unicode(b) | assert | func_call | tests/core/test_unicode.py | test_normalize | 78 | null | |
tfeldmann/organize | from pathlib import Path
from conftest import make_files
from organize import Config
from organize.filters.hash import hash, hash_first_chunk
def test_first_chunk(fs):
hello = Path("hello.txt")
hello.write_text("Hello world")
hash_hello = hash_first_chunk(hello, algo="md5")
assert hash_hello == "3e25... | hash_foo | assert | variable | tests/filters/test_hash.py | test_first_chunk | 44 | null | |
tfeldmann/organize | import pytest
from conftest import make_files, read_files
from organize.config import Config
@pytest.mark.parametrize(
"mode,result",
[
("skip", {"src.txt": "src", "dst.txt": "dst"}),
("overwrite", {"dst.txt": "src"}),
("rename_new", {"dst 2.txt": "src", "dst.txt": "dst"}),
("r... | result | assert | variable | tests/actions/test_move.py | test_move_conflict | 56 | null | |
tfeldmann/organize | from pathlib import Path
import pytest
from conftest import ORGANIZE_DIR
from pyfakefs.fake_filesystem import FakeFilesystem
from organize import Config
from organize.filters.exif import matches_tags
def images_folder(fs: FakeFilesystem):
RESOURCE_DIR = str(ORGANIZE_DIR / "tests" / "resources" / "images-with-exi... | out | assert | variable | tests/filters/test_exif.py | test_exif_read_camera | 61 | null | |
tfeldmann/organize | from conftest import make_files, read_files
from organize import Config
from organize.filters import Name
def test_name_match(fs):
filename = "Invoice_RE1001_2021_01_31.txt"
make_files([filename], "test")
Config.from_string(
"""
rules:
- locations: /test
filters:
... | {"2021": {"01": {"31": {filename: ""}}}} | assert | collection | tests/filters/test_name.py | test_name_match | 100 | null | |
tfeldmann/organize | from unittest.mock import patch
from organize import Config
def test_trash_folder(tmp_path):
testfolder = tmp_path / "test"
testfolder.mkdir()
(testfolder / "testfile.txt").touch()
with patch("organize.actions.trash.trash") as mck:
Config.from_string(
f"""
rules:
... | testfolder) | assert_* | variable | tests/actions/test_trash.py | test_trash_folder | 35 | null | |
tfeldmann/organize | from conftest import make_files, read_files
from organize import Config
def test_name_reverser(fs):
make_files(["desrever.jpg", "emanelif.txt"], "test")
config = """
rules:
- locations: /test
filters:
- extension
- name
- python: |
... | { "reversed.jpg": "", "filename.txt": "", } | assert | collection | tests/filters/test_python.py | test_name_reverser | 95 | null | |
tfeldmann/organize | from datetime import datetime, timedelta
from arrow import now as arrow_now
from organize.filters import Created
from organize.filters.created import read_created
def test_read_created(tmp_path):
f = tmp_path / "file.txt"
f.touch()
assert read_created(f).date() == | datetime.utcnow().date() | assert | func_call | tests/filters/test_created.py | test_read_created | 26 | null | |
tfeldmann/organize | from unittest.mock import patch
from organize import Config
def test_trash_mocked(tmp_path):
testfile = tmp_path / "test.txt"
testfile.touch()
with patch("organize.actions.trash.trash") as mck:
Config.from_string(
f"""
rules:
- locations: {tmp_path}
... | testfile) | assert_* | variable | tests/actions/test_trash.py | test_trash_mocked | 18 | null | |
tfeldmann/organize | from pathlib import Path
from conftest import make_files
from organize import Config
from organize.filters.hash import hash, hash_first_chunk
def test_first_chunk(fs):
hello = Path("hello.txt")
hello.write_text("Hello world")
hash_hello = hash_first_chunk(hello, algo="md5")
assert hash_hello == "3e25... | hash_first_chunk(long_foo, algo="sha1") | assert | func_call | tests/filters/test_hash.py | test_first_chunk | 48 | null | |
tfeldmann/organize | from pathlib import Path
import pytest
from conftest import make_files
from organize import Config
from organize.filters.extension import Extension
def test_extension_empty():
suffix, match = Extension().suffix_match(Path("any.txt"))
assert suffix == | "txt" | assert | string_literal | tests/filters/test_extension.py | test_extension_empty | 29 | null | |
tfeldmann/organize | from pathlib import Path
from conftest import make_files, read_files
from organize.actions.common.target_path import prepare_target_path, user_wants_a_folder
def test_prepare_folder_target_already_exists(fs):
make_files({"some": {"Application.app": {}}})
assert | Path("/some/Application.app/info.plist").resolve() | assert | func_call | tests/actions/test_common.py | test_prepare_folder_target_already_exists | 66 | null | |
tfeldmann/organize | import sys
import pytest
from organize import Config
from organize.filters.macos_tags import list_tags, matches_tags
@pytest.mark.skipif(sys.platform != "darwin", reason="runs only on macOS")
def test_macos_filter(tmp_path, testoutput):
import macos_tags
testdir = tmp_path / "test"
testdir.mkdir()
... | set(["Invoice (red)", "Urgent (green)"]) | assert | func_call | tests/filters/test_macos_tags.py | test_macos_filter | 63 | null | |
tfeldmann/organize | import sys
from organize.utils import (
ChangeDetector,
deep_merge,
deep_merge_inplace,
has_executable,
)
def test_inserts_new_keys():
"""Will it insert new keys by default?"""
a = {"a": 1, "b": {"b1": 2, "b2": 3}}
b = {"a": 1, "b": {"b1": 4, "b3": 5}, "c": 6}
assert deep_merge(a, b)[... | 5 | assert | numeric_literal | tests/test_utils.py | test_inserts_new_keys | 59 | null | |
tfeldmann/organize | from pathlib import Path
import pytest
from conftest import make_files, read_files
from pyfakefs.fake_filesystem import FakeFilesystem
from organize import Config
from organize.filters import Regex
from organize.output import Default
from organize.resource import Resource
@pytest.mark.parametrize(
"path,valid,te... | valid | assert | variable | tests/filters/test_regex.py | test_regex_return | 31 | null | |
tfeldmann/organize | from pathlib import Path
from conftest import make_files, read_files
from organize.actions.common.target_path import prepare_target_path, user_wants_a_folder
def test_prepare_target_path(fs):
# simulate
assert | Path("/test/dst.txt").resolve() | assert | func_call | tests/actions/test_common.py | test_prepare_target_path | 28 | null | |
tfeldmann/organize | from pathlib import Path
from conftest import make_files
from organize import Config
def test_multiple_dirs(fs, testoutput):
make_files(["foo.txt", "bar.txt"], "/test")
make_files(["foo.txt", "bar.txt"], "/test2")
Config.from_string(
"""
rules:
- locations:
- path:... | [] | assert | collection | tests/core/test_location.py | test_multiple_dirs | 87 | null | |
tfeldmann/organize | from pathlib import Path
import pytest
from conftest import make_files, read_files
from organize import Config
from organize.utils import normalize_unicode
def test_folder_umlauts(fs):
make_files(["file1", "file2"], "Erträge")
conf = Path("config.yaml")
conf.write_text(
"""
rules:
- lo... | {} | assert | collection | tests/core/test_unicode.py | test_folder_umlauts | 60 | null | |
tfeldmann/organize | from pathlib import Path
from conftest import make_files
from organize import Config
from organize.filters.hash import hash, hash_first_chunk
def test_hash(fs, testoutput):
make_files({"hello.txt": "Hello world"}, "test")
Config.from_string(
"""
rules:
- locations: /test
... | ["File hash: 3e25960a79dbc69b674cd4ec67a72c62"] | assert | collection | tests/filters/test_hash.py | test_hash | 63 | null | |
tfeldmann/organize | import sys
from organize.utils import (
ChangeDetector,
deep_merge,
deep_merge_inplace,
has_executable,
)
def test_inplace_merge():
a = {}
b = {1: {2: 2, 3: 3, 4: {5: "fin."}}}
a = deep_merge(a, b)
assert a == | b | assert | variable | tests/test_utils.py | test_inplace_merge | 83 | null | |
tfeldmann/organize | from pathlib import Path
import pytest
from conftest import make_files, read_files
from organize.actions.common.conflict import next_free_name, resolve_conflict
from organize.output import JSONL
from organize.resource import Resource
from organize.template import Template
def test_next_free_name_exception(fs):
f... | ValueError) | pytest.raises | variable | tests/actions/test_conflict_resolution.py | test_next_free_name_exception | 41 | null | |
tfeldmann/organize | from pathlib import Path
from conftest import make_files, read_files
from organize.actions.common.target_path import prepare_target_path, user_wants_a_folder
def test_prepare_folder_no_folder(fs):
assert (
prepare_target_path(
src_name="filename.txt",
dst="/some/original/folder/na... | {"original": {"folder": {}}} | assert | collection | tests/actions/test_common.py | test_prepare_folder_no_folder | 88 | null | |
tfeldmann/organize | import sys
from organize.utils import (
ChangeDetector,
deep_merge,
deep_merge_inplace,
has_executable,
)
def test_returns_copy():
a = {"regex": {"first": "A", "second": "B"}}
b = {"regex": {"third": "C"}}
x = deep_merge(a, b)
a["regex"]["first"] = "X"
assert x["regex"]["first"] =... | "C" | assert | string_literal | tests/test_utils.py | test_returns_copy | 48 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.