repo_id stringclasses 400
values | commit_sha stringclasses 400
values | commit_index int32 0 951 | in_repo_split stringclasses 1
value | cross_repo_split stringclasses 1
value | test_file stringlengths 7 121 | test_function stringlengths 1 108 | assertion_type stringclasses 32
values | difficulty stringclasses 8
values | context_lines int32 3 600 | prefix large_stringlengths 44 113k | target large_stringlengths 1 498 | anchor_sha stringclasses 400
values | anchor_index int32 0 951 | qna_source stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
temporalio/samples-python | ffb2b5ae0c54f12dbefb50d17297ab47cf2e4465 | 28 | train | train | tests/message_passing/waiting_for_handlers/waiting_for_handlers_test.py | test_waiting_for_handlers | pytest.raises | complex_expr | 63 | from enum import Enum
import pytest
from temporalio import client, worker
from temporalio.testing import WorkflowEnvironment
from message_passing.waiting_for_handlers import WorkflowExitType, WorkflowInput
from message_passing.waiting_for_handlers.activities import (
activity_executed_by_update_handler,
)
from me... | client.WorkflowUpdateFailedError) | ffb2b5ae0c54f12dbefb50d17297ab47cf2e4465 | 28 | v2_extractor_at_anchor |
temporalio/samples-python | ffb2b5ae0c54f12dbefb50d17297ab47cf2e4465 | 28 | train | train | tests/message_passing/waiting_for_handlers_and_compensation/waiting_for_handlers_and_compensation_test.py | test_waiting_for_handlers_and_compensation | pytest.raises | complex_expr | 92 | import uuid
from enum import Enum
import pytest
from temporalio import client, worker
from temporalio.testing import WorkflowEnvironment
from message_passing.waiting_for_handlers_and_compensation import (
WorkflowExitType,
WorkflowInput,
)
from message_passing.waiting_for_handlers_and_compensation.activities ... | client.WorkflowFailureError) | ffb2b5ae0c54f12dbefb50d17297ab47cf2e4465 | 28 | v2_extractor_at_anchor |
temporalio/samples-python | ffb2b5ae0c54f12dbefb50d17297ab47cf2e4465 | 28 | train | train | tests/message_passing/waiting_for_handlers_and_compensation/waiting_for_handlers_and_compensation_test.py | test_waiting_for_handlers_and_compensation | pytest.raises | complex_expr | 78 | import uuid
from enum import Enum
import pytest
from temporalio import client, worker
from temporalio.testing import WorkflowEnvironment
from message_passing.waiting_for_handlers_and_compensation import (
WorkflowExitType,
WorkflowInput,
)
from message_passing.waiting_for_handlers_and_compensation.activities ... | client.WorkflowUpdateFailedError) | ffb2b5ae0c54f12dbefb50d17297ab47cf2e4465 | 28 | v2_extractor_at_anchor |
temporalio/samples-python | ffb2b5ae0c54f12dbefb50d17297ab47cf2e4465 | 28 | train | train | tests/polling/infrequent/workflow_test.py | test_infrequent_polling_workflow | assert | string_literal | 31 | import uuid
import pytest
from temporalio.client import Client
from temporalio.testing import WorkflowEnvironment
from temporalio.worker import Worker
from polling.infrequent.activities import compose_greeting
from polling.infrequent.workflows import GreetingWorkflow
async def test_infrequent_polling_workflow(client... | "Hello, Temporal!" | ffb2b5ae0c54f12dbefb50d17297ab47cf2e4465 | 28 | v2_extractor_at_anchor |
temporalio/samples-python | ffb2b5ae0c54f12dbefb50d17297ab47cf2e4465 | 28 | train | train | tests/pydantic_converter/workflow_test.py | test_workflow_with_pydantic_model | assert | variable | 40 | import uuid
from datetime import datetime
from ipaddress import IPv4Address
from temporalio.client import Client
from temporalio.contrib.pydantic import pydantic_data_converter
from temporalio.worker import Worker
from pydantic_converter.worker import MyPydanticModel, MyWorkflow, my_activity
async def test_workflow_... | result | ffb2b5ae0c54f12dbefb50d17297ab47cf2e4465 | 28 | v2_extractor_at_anchor |
temporalio/samples-python | ffb2b5ae0c54f12dbefb50d17297ab47cf2e4465 | 28 | train | train | tests/pydantic_converter_v1/workflow_test.py | test_workflow_with_pydantic_model | assert | variable | 46 | import uuid
from datetime import datetime
from ipaddress import IPv4Address
from temporalio.client import Client
from temporalio.worker import Worker
from pydantic_converter_v1.converter import pydantic_data_converter
from pydantic_converter_v1.worker import (
MyPydanticModel,
MyWorkflow,
my_activity,
... | result | ffb2b5ae0c54f12dbefb50d17297ab47cf2e4465 | 28 | v2_extractor_at_anchor |
temporalio/samples-python | ffb2b5ae0c54f12dbefb50d17297ab47cf2e4465 | 28 | train | train | tests/resource_pool/workflow_test.py | test_resource_pool_workflow | assert | none_literal | 62 | import asyncio
from collections import defaultdict
from typing import Any, Optional, Sequence
from temporalio import activity
from temporalio.client import Client, WorkflowFailureError, WorkflowHandle
from temporalio.common import WorkflowIDConflictPolicy
from temporalio.worker import Worker
from resource_pool.pool_c... | None | ffb2b5ae0c54f12dbefb50d17297ab47cf2e4465 | 28 | v2_extractor_at_anchor |
temporalio/samples-python | ffb2b5ae0c54f12dbefb50d17297ab47cf2e4465 | 28 | train | train | tests/resource_pool/workflow_test.py | test_resource_pool_workflow | assert | variable | 51 | import asyncio
from collections import defaultdict
from typing import Any, Optional, Sequence
from temporalio import activity
from temporalio.client import Client, WorkflowFailureError, WorkflowHandle
from temporalio.common import WorkflowIDConflictPolicy
from temporalio.worker import Worker
from resource_pool.pool_c... | resource | ffb2b5ae0c54f12dbefb50d17297ab47cf2e4465 | 28 | v2_extractor_at_anchor |
temporalio/samples-python | ffb2b5ae0c54f12dbefb50d17297ab47cf2e4465 | 28 | train | train | tests/resource_pool/workflow_test.py | test_resource_pool_workflow | assert | variable | 67 | import asyncio
from collections import defaultdict
from typing import Any, Optional, Sequence
from temporalio import activity
from temporalio.client import Client, WorkflowFailureError, WorkflowHandle
from temporalio.common import WorkflowIDConflictPolicy
from temporalio.worker import Worker
from resource_pool.pool_c... | workflow_id | ffb2b5ae0c54f12dbefb50d17297ab47cf2e4465 | 28 | v2_extractor_at_anchor |
temporalio/samples-python | ffb2b5ae0c54f12dbefb50d17297ab47cf2e4465 | 28 | train | train | tests/resource_pool/workflow_test.py | test_resource_pool_workflow | assert | collection | 79 | import asyncio
from collections import defaultdict
from typing import Any, Optional, Sequence
from temporalio import activity
from temporalio.client import Client, WorkflowFailureError, WorkflowHandle
from temporalio.common import WorkflowIDConflictPolicy
from temporalio.worker import Worker
from resource_pool.pool_c... | {"r_a": None, "r_b": None, "r_c": None} | ffb2b5ae0c54f12dbefb50d17297ab47cf2e4465 | 28 | v2_extractor_at_anchor |
temporalio/samples-python | ffb2b5ae0c54f12dbefb50d17297ab47cf2e4465 | 28 | train | train | tests/sleep_for_days/workflow_test.py | test_sleep_for_days_workflow | assert | numeric_literal | 43 | import uuid
from datetime import timedelta
from temporalio import activity
from temporalio.testing import WorkflowEnvironment
from temporalio.worker import Worker
from sleep_for_days.starter import TASK_QUEUE
from sleep_for_days.workflows import SendEmailInput, SleepForDaysWorkflow
async def test_sleep_for_days_work... | 1 | ffb2b5ae0c54f12dbefb50d17297ab47cf2e4465 | 28 | v2_extractor_at_anchor |
temporalio/samples-python | ffb2b5ae0c54f12dbefb50d17297ab47cf2e4465 | 28 | train | train | tests/sleep_for_days/workflow_test.py | test_sleep_for_days_workflow | assert | numeric_literal | 47 | import uuid
from datetime import timedelta
from temporalio import activity
from temporalio.testing import WorkflowEnvironment
from temporalio.worker import Worker
from sleep_for_days.starter import TASK_QUEUE
from sleep_for_days.workflows import SendEmailInput, SleepForDaysWorkflow
async def test_sleep_for_days_work... | 4 | ffb2b5ae0c54f12dbefb50d17297ab47cf2e4465 | 28 | v2_extractor_at_anchor |
temporalio/samples-python | ffb2b5ae0c54f12dbefb50d17297ab47cf2e4465 | 28 | train | train | tests/sleep_for_days/workflow_test.py | test_sleep_for_days_workflow | assert | func_call | 53 | import uuid
from datetime import timedelta
from temporalio import activity
from temporalio.testing import WorkflowEnvironment
from temporalio.worker import Worker
from sleep_for_days.starter import TASK_QUEUE
from sleep_for_days.workflows import SendEmailInput, SleepForDaysWorkflow
async def test_sleep_for_days_work... | timedelta(days=90) | ffb2b5ae0c54f12dbefb50d17297ab47cf2e4465 | 28 | v2_extractor_at_anchor |
temporalio/samples-python | ffb2b5ae0c54f12dbefb50d17297ab47cf2e4465 | 28 | train | train | tests/trio_async/workflow_test.py | test_workflow_with_trio | assert | collection | 37 | import uuid
import trio_asyncio
from temporalio.client import Client
from temporalio.worker import Worker
from trio_async import activities, workflows
async def test_workflow_with_trio(client: Client):
@trio_asyncio.aio_as_trio
async def inside_trio(client: Client) -> list[str]:
# Create Trio thread ... | [ "Hello, some-user! (from asyncio)", "Hello, some-user! (from thread)", ] | ffb2b5ae0c54f12dbefb50d17297ab47cf2e4465 | 28 | v2_extractor_at_anchor |
textstat/textstat | 69bc4808a535e8206255fed337d57c26971a2957 | 39 | train | train | test.py | test_lru_caching | assert | numeric_literal | 207 | import textstat
short_test = "Cool dogs wear da sunglasses."
punct_text = """
I said: 'This is a test sentence to test the remove_punctuation function.
It's short and not the work of a singer-songwriter. But it'll suffice.'
Your answer was: "I don't know. If I were you I'd write a test; just to make
sure, you're real... | 1 | 69bc4808a535e8206255fed337d57c26971a2957 | 39 | v2_extractor_at_anchor |
textstat/textstat | 69bc4808a535e8206255fed337d57c26971a2957 | 39 | train | train | test.py | test_spache_readability | assert | numeric_literal | 201 | import textstat
short_test = "Cool dogs wear da sunglasses."
punct_text = """
I said: 'This is a test sentence to test the remove_punctuation function.
It's short and not the work of a singer-songwriter. But it'll suffice.'
Your answer was: "I don't know. If I were you I'd write a test; just to make
sure, you're real... | 2 | 69bc4808a535e8206255fed337d57c26971a2957 | 39 | v2_extractor_at_anchor |
textstat/textstat | 69bc4808a535e8206255fed337d57c26971a2957 | 39 | train | train | test.py | test_sentence_count | assert | numeric_literal | 201 | import textstat
short_test = "Cool dogs wear da sunglasses."
punct_text = """
I said: 'This is a test sentence to test the remove_punctuation function.
It's short and not the work of a singer-songwriter. But it'll suffice.'
Your answer was: "I don't know. If I were you I'd write a test; just to make
sure, you're real... | 17 | 69bc4808a535e8206255fed337d57c26971a2957 | 39 | v2_extractor_at_anchor |
textstat/textstat | 69bc4808a535e8206255fed337d57c26971a2957 | 39 | train | train | test.py | test_sentence_count_russian | assert | numeric_literal | 201 | import textstat
short_test = "Cool dogs wear da sunglasses."
punct_text = """
I said: 'This is a test sentence to test the remove_punctuation function.
It's short and not the work of a singer-songwriter. But it'll suffice.'
Your answer was: "I don't know. If I were you I'd write a test; just to make
sure, you're real... | 16 | 69bc4808a535e8206255fed337d57c26971a2957 | 39 | v2_extractor_at_anchor |
textstat/textstat | 69bc4808a535e8206255fed337d57c26971a2957 | 39 | train | train | test.py | test_polysyllabcount | assert | numeric_literal | 201 | import textstat
short_test = "Cool dogs wear da sunglasses."
punct_text = """
I said: 'This is a test sentence to test the remove_punctuation function.
It's short and not the work of a singer-songwriter. But it'll suffice.'
Your answer was: "I don't know. If I were you I'd write a test; just to make
sure, you're real... | 32 | 69bc4808a535e8206255fed337d57c26971a2957 | 39 | v2_extractor_at_anchor |
textstat/textstat | 69bc4808a535e8206255fed337d57c26971a2957 | 39 | train | train | test.py | test_difficult_words | assert | numeric_literal | 201 | import textstat
short_test = "Cool dogs wear da sunglasses."
punct_text = """
I said: 'This is a test sentence to test the remove_punctuation function.
It's short and not the work of a singer-songwriter. But it'll suffice.'
Your answer was: "I don't know. If I were you I'd write a test; just to make
sure, you're real... | 49 | 69bc4808a535e8206255fed337d57c26971a2957 | 39 | v2_extractor_at_anchor |
textstat/textstat | 69bc4808a535e8206255fed337d57c26971a2957 | 39 | train | train | test.py | test_lexicon_count | assert | numeric_literal | 202 | import textstat
short_test = "Cool dogs wear da sunglasses."
punct_text = """
I said: 'This is a test sentence to test the remove_punctuation function.
It's short and not the work of a singer-songwriter. But it'll suffice.'
Your answer was: "I don't know. If I were you I'd write a test; just to make
sure, you're real... | 372 | 69bc4808a535e8206255fed337d57c26971a2957 | 39 | v2_extractor_at_anchor |
textstat/textstat | 69bc4808a535e8206255fed337d57c26971a2957 | 39 | train | train | test.py | test_lexicon_count | assert | numeric_literal | 203 | import textstat
short_test = "Cool dogs wear da sunglasses."
punct_text = """
I said: 'This is a test sentence to test the remove_punctuation function.
It's short and not the work of a singer-songwriter. But it'll suffice.'
Your answer was: "I don't know. If I were you I'd write a test; just to make
sure, you're real... | 376 | 69bc4808a535e8206255fed337d57c26971a2957 | 39 | v2_extractor_at_anchor |
textstat/textstat | 69bc4808a535e8206255fed337d57c26971a2957 | 39 | train | train | test.py | test_syllable_count | assert | numeric_literal | 201 | import textstat
short_test = "Cool dogs wear da sunglasses."
punct_text = """
I said: 'This is a test sentence to test the remove_punctuation function.
It's short and not the work of a singer-songwriter. But it'll suffice.'
Your answer was: "I don't know. If I were you I'd write a test; just to make
sure, you're real... | 519 | 69bc4808a535e8206255fed337d57c26971a2957 | 39 | v2_extractor_at_anchor |
textstat/textstat | 69bc4808a535e8206255fed337d57c26971a2957 | 39 | train | train | test.py | test_avg_syllables_per_word | assert | numeric_literal | 201 | import textstat
short_test = "Cool dogs wear da sunglasses."
punct_text = """
I said: 'This is a test sentence to test the remove_punctuation function.
It's short and not the work of a singer-songwriter. But it'll suffice.'
Your answer was: "I don't know. If I were you I'd write a test; just to make
sure, you're real... | 1.4 | 69bc4808a535e8206255fed337d57c26971a2957 | 39 | v2_extractor_at_anchor |
textstat/textstat | 69bc4808a535e8206255fed337d57c26971a2957 | 39 | train | train | test.py | test_flesch_kincaid_grade | assert | numeric_literal | 201 | import textstat
short_test = "Cool dogs wear da sunglasses."
punct_text = """
I said: 'This is a test sentence to test the remove_punctuation function.
It's short and not the work of a singer-songwriter. But it'll suffice.'
Your answer was: "I don't know. If I were you I'd write a test; just to make
sure, you're real... | 9.5 | 69bc4808a535e8206255fed337d57c26971a2957 | 39 | v2_extractor_at_anchor |
textstat/textstat | 69bc4808a535e8206255fed337d57c26971a2957 | 39 | train | train | test.py | test_dale_chall_readability_score | assert | numeric_literal | 205 | import textstat
short_test = "Cool dogs wear da sunglasses."
punct_text = """
I said: 'This is a test sentence to test the remove_punctuation function.
It's short and not the work of a singer-songwriter. But it'll suffice.'
Your answer was: "I don't know. If I were you I'd write a test; just to make
sure, you're real... | 0.0 | 69bc4808a535e8206255fed337d57c26971a2957 | 39 | v2_extractor_at_anchor |
textstat/textstat | 69bc4808a535e8206255fed337d57c26971a2957 | 39 | train | train | test.py | test_dale_chall_readability_score_v2 | assert | numeric_literal | 201 | import textstat
short_test = "Cool dogs wear da sunglasses."
punct_text = """
I said: 'This is a test sentence to test the remove_punctuation function.
It's short and not the work of a singer-songwriter. But it'll suffice.'
Your answer was: "I don't know. If I were you I'd write a test; just to make
sure, you're real... | 6.8 | 69bc4808a535e8206255fed337d57c26971a2957 | 39 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_common.py | test_prepare_target_path | assert | collection | 24 | 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/",
autodetect_folder=Tr... | {} | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_common.py | test_prepare_target_path | assert | func_call | 10 | 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
asser | Path("/test/dst.txt") | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_common.py | test_prepare_folder_target_already_exists | assert | collection | 16 | 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 prepare_target_path(
src_name="info.pli... | {"Application.app": {}} | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_common.py | test_prepare_folder_target_advanced | assert | collection | 15 | 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 prepare_target_path(
src_name="dst",
dst="/some/test/folder",
autodetect_folder... | {"test": {"folder": {}}} | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_common.py | test_prepare_folder_no_folder | assert | collection | 15 | 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/name.txt",
a... | {"original": {"folder": {}}} | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_common.py | test_prepare_folder_target_advanced | assert | func_call | 9 | 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):
asser | Path("/some/test/folder/dst") | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_common.py | test_prepare_folder_no_folder | assert | func_call | 9 | 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):
asser | Path("/some/original/folder/name.txt") | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_common.py | test_prepare_folder_target_already_exists | assert | func_call | 10 | 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": {}}})
asser | Path("/some/Application.app/info.plist") | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_conflict_resolution.py | test_next_free_name_exception | pytest.raises | variable | 16 | 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) | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_conflict_resolution.py | test_next_free_name | assert | func_call | 34 | 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
@pytest.mark.parametrize(
"template,want... | Path(result) | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_conflict_resolution.py | test_resolve_overwrite_conflict | assert | func_call | 56 | 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
@pytest.mark.parametrize(
"mode,result,f... | read_files("test") | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_conflict_resolution.py | test_conflicting_folders | assert | func_call | 23 | 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") | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_conflict_resolution.py | test_resolve_overwrite_conflict | assert | collection | 55 | 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
@pytest.mark.parametrize(
"mode,result,f... | (result[0], Path(result[1])) | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_copy.py | test_copy_on_itself | assert | variable | 26 | import pytest
from conftest import make_files, read_files
from organize import Config
FILES = {
"test.txt": "",
"file.txt": "Hello world\nAnother line",
"another.txt": "",
"folder": {
"x.txt": "",
},
}
def test_copy_on_itself(fs):
make_files(FILES, "test")
config = """
rules:
... | FILES | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_copy.py | test_copy_conflict | assert | variable | 44 | import pytest
from conftest import make_files, read_files
from organize import Config
FILES = {
"test.txt": "",
"file.txt": "Hello world\nAnother line",
"another.txt": "",
"folder": {
"x.txt": "",
},
}
@pytest.mark.parametrize(
"mode,result",
[
("skip", {"src.txt": "src", ... | result | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_copy.py | test_copy_basic | assert | collection | 27 | import pytest
from conftest import make_files, read_files
from organize import Config
FILES = {
"test.txt": "",
"file.txt": "Hello world\nAnother line",
"another.txt": "",
"folder": {
"x.txt": "",
},
}
def test_copy_basic(fs):
config = """
rules:
- locations: "test"
... | { "newname.pdf": "", "newname 2.pdf": "", "newname 3.pdf": "", "test.pdf": "", "asd.txt": "", } | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_copy.py | test_copy_into_dir | assert | collection | 26 | import pytest
from conftest import make_files, read_files
from organize import Config
FILES = {
"test.txt": "",
"file.txt": "Hello world\nAnother line",
"another.txt": "",
"folder": {
"x.txt": "",
},
}
def test_copy_into_dir(fs):
make_files(FILES, "test")
config = """
rules:
... | { "test.txt": "", "file.txt": "Hello world\nAnother line", "another.txt": "", "folder": { "x.txt": "", }, "a brand": { "new": { "folder": { "test.txt": "", "file.txt": "Hello world\nAnother line", "another.txt": "", } } }, } | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_copy.py | test_copy_into_dir_subfolders | assert | collection | 27 | import pytest
from conftest import make_files, read_files
from organize import Config
FILES = {
"test.txt": "",
"file.txt": "Hello world\nAnother line",
"another.txt": "",
"folder": {
"x.txt": "",
},
}
def test_copy_into_dir_subfolders(fs):
make_files(FILES, "test")
config = """
... | { "test.txt": "", "file.txt": "Hello world\nAnother line", "another.txt": "", "folder": { "x.txt": "", }, "a brand": { "new": { "folder": { "test.txt": "", "file.txt": "Hello world\nAnother line", "another.txt": "", "x.txt": "", } } }, } | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_delete.py | test_delete_deep | assert | collection | 48 | from conftest import make_files, read_files
from organize import Config
FILES = {
"test.txt": "",
"file.txt": "Hello world\nAnother line",
"another.txt": "",
"folder": {
"x.txt": "",
"empty_sub": {},
},
"empty_folder": {},
}
def test_delete_deep(fs):
files = {
"fil... | {} | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_delete.py | test_delete_deep | assert | variable | 43 | from conftest import make_files, read_files
from organize import Config
FILES = {
"test.txt": "",
"file.txt": "Hello world\nAnother line",
"another.txt": "",
"folder": {
"x.txt": "",
"empty_sub": {},
},
"empty_folder": {},
}
def test_delete_deep(fs):
files = {
"fil... | files | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_delete.py | test_delete_empty_files | assert | collection | 32 | from conftest import make_files, read_files
from organize import Config
FILES = {
"test.txt": "",
"file.txt": "Hello world\nAnother line",
"another.txt": "",
"folder": {
"x.txt": "",
"empty_sub": {},
},
"empty_folder": {},
}
def test_delete_empty_files(fs):
config = """
... | { "file.txt": "Hello world\nAnother line", "folder": { "empty_sub": {}, }, "empty_folder": {}, } | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_delete.py | test_delete_empty_dirs | assert | collection | 32 | from conftest import make_files, read_files
from organize import Config
FILES = {
"test.txt": "",
"file.txt": "Hello world\nAnother line",
"another.txt": "",
"folder": {
"x.txt": "",
"empty_sub": {},
},
"empty_folder": {},
}
def test_delete_empty_dirs(fs):
config = """
... | { "test.txt": "", "file.txt": "Hello world\nAnother line", "another.txt": "", "folder": { "x.txt": "", }, } | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_echo.py | test_echo_basic | assert | collection | 17 | 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"] | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_echo.py | test_echo_path | assert | func_call | 19 | from collections import Counter
from datetime import datetime
from conftest import make_files
from organize import Config
def test_echo_path(fs, testoutput):
make_files(["fileA.txt", "fileB.txt"], "test")
Config.from_string(
"""
rules:
- locations: /test
actions:
... | Counter(["fileA", "fileB"]) | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_echo.py | test_echo_args | assert | collection | 17 | from collections import Counter
from datetime import datetime
from conftest import make_files
from organize import Config
def test_echo_args(testoutput):
Config.from_string(
"""
rules:
- actions:
- echo: "Date formatting: {now().strftime('%Y')}"
"""
).execute(s... | [f"Date formatting: {datetime.now().year}"] | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_macos_tags.py | test_macos_action | assert | collection | 28 | 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)"] | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_macos_tags.py | test_macos_action | assert | collection | 27 | 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()
... | ["file (green)"] | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_move.py | test_move_onto_itself | assert | variable | 24 | 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 | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_move.py | test_move_conflict | assert | variable | 36 | 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 | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_move.py | test_move_folder_conflict | assert | collection | 29 | import pytest
from conftest import make_files, read_files
from organize.config import Config
def test_move_folder_conflict(fs):
make_files(
{
"src": {"dir": {"src.txt": ""}},
"dst": {"dir": {"dst.txt": ""}},
},
"test",
)
# src is moved onto dst.
Config.f... | { "src": {}, "dst": { "dir": {"dst.txt": ""}, "dir 2": {"src.txt": ""}, }, } | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_python.py | test_python | assert | collection | 25 | from pathlib import Path
from conftest import make_files
from organize import Config
def test_python(fs, testoutput):
make_files({"file.txt": "File content"}, "test")
Config.from_string(
"""
rules:
- locations: /test
actions:
- python: |
... | [ f"Handling: {Path('/test/file.txt')}", "File content", ] | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_rename.py | test_filename_move | assert | collection | 18 | from conftest import make_files, read_files
from organize import Config
def test_filename_move(fs):
make_files({"test.PY": ""}, "test")
Config.from_string(
"""
rules:
- locations: "/test"
filters:
- extension
actions:
- rename: '{path.s... | {"testtest.py": ""} | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_rename.py | test_rename_in_subfolders | assert | collection | 33 | from conftest import make_files, read_files
from organize import Config
def test_rename_in_subfolders(fs):
files = {
"folder": {
"FIRST-RENAME.pdf": "",
"Other": "",
},
"Another folder": {
"Subfolder": {
"RENAME-ME_TOO.txt": "",
... | { "folder": { "DONE.pdf": "", "Other": "", }, "Another folder": { "Subfolder": { "DONE.txt": "", }, "Metadata": "", }, } | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_rename.py | test_rename_issue51 | assert | collection | 31 | from conftest import make_files, read_files
from organize import Config
def test_rename_issue51(fs):
# test for issue https://github.com/tfeldmann/organize/issues/51
files = {
"19asd_WF_test2.PDF": "",
"other.pdf": "",
"18asd_WFX_test2.pdf": "",
}
make_files(files, "test")
... | { "copy": { "19asd_WF_test2_unread.pdf": "", }, "19asd_WF_test2_unread.pdf": "", "other.pdf": "", "18asd_WFX_test2.pdf": "", } | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_rename.py | test_rename_folders | assert | collection | 32 | 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": "", }, } | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_shell.py | test_shell | assert | collection | 16 | 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": "", } | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_symlink.py | test_symlink | assert | string_literal | 20 | 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" | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_trash.py | test_trash_mocked | assert_* | variable | 18 | 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) | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_trash.py | test_trash_folder | assert_* | variable | 20 | 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) | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_write.py | test_write | assert | func_call | 60 | from pathlib import Path
import pytest
from conftest import make_files, read_files
from organize.config import Config
@pytest.mark.parametrize(
("mode", "newline", "result"),
[
("append", "true", "a\nb\nc\n"),
("append", "false", "abc"),
("prepend", "true", "c\nb\na\n"),
("pre... | f.read() | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_write.py | test_write_manyfiles | assert | collection | 24 | from pathlib import Path
import pytest
from conftest import make_files, read_files
from organize.config import Config
def test_write_manyfiles(fs):
make_files({"test1.txt": "content\n", "test2.txt": "Other"}, "test")
Config.from_string(
"""
rules:
- locations: "/test"
... | { "for-test1.txt": "WRITE test1.txt", "for-test2.txt": "WRITE test2.txt", } | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/actions/test_write.py | test_write_clear_then_append | assert | collection | 38 | from pathlib import Path
import pytest
from conftest import make_files, read_files
from organize.config import Config
def test_write_clear_then_append(fs):
make_files({"test1.txt": "", "test2.txt": ""}, "loc1")
make_files({"test1.txt": "", "test2.txt": ""}, "loc2")
make_files(
{
"test... | { "test1": { "test1.log": f"FOUND {Path('loc1/test1.txt')}\nFOUND {Path('loc2/test1.txt')}\n" }, "test2": { "test2.log": f"FOUND {Path('loc1/test2.txt')}\nFOUND {Path('loc2/test2.txt')}\n" }, } | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/combined/test_codepost_usecase.py | test_codepost_usecase | assert | collection | 36 | from conftest import make_files, read_files
from organize import Config
def test_codepost_usecase(fs):
files = {
"Devonte-Betts.txt": "",
"Alaina-Cornish.txt": "",
"Dimitri-Bean.txt": "",
"Lowri-Frey.txt": "",
"Someunknown-User.txt": "",
}
make_files(files, "test")
... | { "dbetts@mail.de.txt": "", "acornish@google.com.txt": "", "dbean@aol.com.txt": "", "l-frey@frey.org.txt": "", } | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/combined/test_dependent_rules.py | test_dependent_rules | assert | collection | 29 | from conftest import make_files, read_files
from organize import Config
def test_dependent_rules(fs):
files = {
"asd.txt": "",
"newname 2.pdf": "",
"newname.pdf": "",
"test.pdf": "",
}
make_files(files, "test")
Config.from_string(
"""
rules:
- locations:... | { "newname.pdf": "", "newname 2.pdf": "", "test.pdf": "", "asd.txt": "", "newfolder": {"test-found.pdf": ""}, } | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/combined/test_example_config.py | test_example_config | assert | collection | 9 | from organize import Config
from organize.cli import EXAMPLE_CONFIG
from organize.output import JSONL, Default
def test_example_config(testoutput):
config = Config.from_string(EXAMPLE_CONFIG)
config.execute(simulate=False, output=testoutput)
assert testoutput.messages == | ["Hello, World!"] | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/combined/test_rename_regex.py | test_rename_files_date | assert | collection | 24 | from conftest import make_files, read_files
from organize import Config
def test_rename_files_date(fs):
# inspired by https://github.com/tfeldmann/organize/issues/43
files = {
"File_abc_dat20190812_xyz.pdf": "",
"File_xyz_bar19990101_a.pdf": "",
"File_123456_foo20000101_xyz20190101.pdf... | { "File_12082019.pdf": "", "File_01011999.pdf": "", "File_01012000.pdf": "", } | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/core/test_config.py | test_error_filter_dict | pytest.raises | variable | 16 | import pytest
from organize.config import Config, ConfigError
def test_error_filter_dict():
STR = """
rules:
- locations: '/'
filters:
extension: 'jpg'
name: test
actions:
- trash
"""
with pytest.raises( | ConfigError) | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/core/test_filter_mode.py | test_filter_mode | assert | variable | 28 | import pytest
from conftest import make_files
from organize import Config
@pytest.mark.parametrize(
"filter_mode, expected_msgs",
(
("any", ["foo", "x"]),
("all", ["foo"]),
("none", ["baz"]),
),
)
def test_filter_mode(fs, testoutput, filter_mode, expected_msgs):
make_files(["fo... | expected_msgs | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/core/test_ignore_seen_files.py | test_ignore_seen_files | assert | collection | 24 | from conftest import make_files, read_files
from organize import Config
def test_ignore_seen_files(fs):
make_files(
{
"sub": {},
"foo.txt": "",
"bar.txt": "",
},
"test",
)
config = """
rules:
- locations: /test
subfolders: true
... | { "sub": { "foo.txt": "", "bar.txt": "", } } | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/core/test_ignore_seen_files.py | test_issue_200 | assert | collection | 23 | from conftest import make_files, read_files
from organize import Config
def test_issue_200(fs):
# https://github.com/tfeldmann/organize/issues/200
config = """
# try to extract the first date from the file and rename it accordingly
rules:
- name: date_rename
locations: scan
filte... | { "2022-23-03_20220401_173738.txt": "Datum: 23.03.2022", } | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/core/test_location.py | test_standalone | assert | numeric_literal | 20 | from pathlib import Path
from conftest import make_files
from organize import Config
def test_standalone(testoutput):
Config.from_string(
"""
rules:
- actions:
- echo: "Do this"
- echo: "And this"
- actions:
- echo: "And that"
"""
).... | 2 | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/core/test_location.py | test_standalone | assert | numeric_literal | 21 | from pathlib import Path
from conftest import make_files
from organize import Config
def test_standalone(testoutput):
Config.from_string(
"""
rules:
- actions:
- echo: "Do this"
- echo: "And this"
- actions:
- echo: "And that"
"""
).... | 0 | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/core/test_location.py | test_multiple_dirs | assert | collection | 23 | 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:... | [] | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/core/test_location.py | test_single_file | assert | collection | 20 | from pathlib import Path
from conftest import make_files
from organize import Config
def test_single_file(fs, testoutput):
make_files(["foo.txt", "bar.txt"], "/test")
Config.from_string(
"""
rules:
- locations:
- /test/foo.txt
- /test/bar.txt
... | ["foo.txt", "bar.txt"] | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/core/test_location.py | test_multiple_pathes | assert | collection | 21 | 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... | ["foo.txt", "bar.txt"] * 2 | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/core/test_location.py | test_standalone | assert | collection | 19 | from pathlib import Path
from conftest import make_files
from organize import Config
def test_standalone(testoutput):
Config.from_string(
"""
rules:
- actions:
- echo: "Do this"
- echo: "And this"
- actions:
- echo: "And that"
"""
).... | ["Do this", "And this", "And that"] | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/core/test_tags.py | test_tags | assert | variable | 40 | import pytest
from organize.config import should_execute
@pytest.mark.parametrize(
"result, rule_tags, tags, skip_tags",
(
# no tags given
(True, None, None, None),
(True, ["tag"], None, None),
(True, ["tag", "tag2"], None, None),
# run tagged
(False, None, ["ta... | result | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/core/test_unicode.py | test_folder_umlauts | assert | collection | 23 | from pathlib import Path
import pytest
from conftest import make_files, read_files
from organize import Config
def test_folder_umlauts(fs):
make_files(["file1", "file2"], "Erträge")
conf = Path("config.yaml")
conf.write_text(
"""
rules:
- locations: "Erträge"
actions:
... | {} | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/core/test_unicode.py | test_normalization_regex | assert | collection | 26 | from pathlib import Path
import pytest
from conftest import make_files, read_files
from organize import Config
@pytest.mark.skip(reason="TODO")
def test_normalization_regex(testfs):
make_files(
testfs,
{b"Ertra\xcc\x88gnisaufstellung.txt".decode("utf-8"): ""},
)
config = (
b"""
... | {"found-regex.txt"} | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/core/test_unicode.py | test_startswith_issue74 | assert | collection | 32 | from pathlib import Path
import pytest
from conftest import make_files, read_files
from organize import Config
def test_startswith_issue74(fs):
# test for issue https://github.com/tfeldmann/organize/issues/74
make_files(
{
"Cálculo_1.pdf": "",
"Cálculo_2.pdf": "",
... | { "Cálculo Integral": { "Periodo #6": { "PDF's": { "Cálculo_1.pdf": "", "Cálculo_2.pdf": "", } } }, "Calculo.pdf": "", } | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/core/test_walker.py | test_walk | assert | func_call | 100 | from collections import Counter
from pathlib import Path
import pytest
from pyfakefs.fake_filesystem import FakeFilesystem
from organize.walker import Walker
def counter(items):
return Counter(str(x) for x in items)
@pytest.mark.parametrize("method", ("depth", "breadth"))
def test_walk(fs: FakeFilesystem, metho... | counter( [ Path("/test/d1/d1/d1"), Path("/test/d1/d1/d2"), ] ) | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/core/test_walker.py | test_walk | assert | func_call | 55 | from collections import Counter
from pathlib import Path
import pytest
from pyfakefs.fake_filesystem import FakeFilesystem
from organize.walker import Walker
def counter(items):
return Counter(str(x) for x in items)
@pytest.mark.parametrize("method", ("depth", "breadth"))
def test_walk(fs: FakeFilesystem, metho... | counter( [ Path("/test/d1/d1/f1.txt"), Path("/test/d1/d1/f2.txt"), ] ) | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/core/test_walker.py | test_walk | assert | func_call | 45 | from collections import Counter
from pathlib import Path
import pytest
from pyfakefs.fake_filesystem import FakeFilesystem
from organize.walker import Walker
def counter(items):
return Counter(str(x) for x in items)
@pytest.mark.parametrize("method", ("depth", "breadth"))
def test_walk(fs: FakeFilesystem, metho... | counter( [ Path("/test/d1/f1.txt"), Path("/test/d1/d1/f1.txt"), Path("/test/d1/d1/f2.txt"), ] ) | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/core/test_walker.py | test_walk | assert | func_call | 76 | from collections import Counter
from pathlib import Path
import pytest
from pyfakefs.fake_filesystem import FakeFilesystem
from organize.walker import Walker
def counter(items):
return Counter(str(x) for x in items)
@pytest.mark.parametrize("method", ("depth", "breadth"))
def test_walk(fs: FakeFilesystem, metho... | counter( [ Path("/test/d1/d1"), Path("/test/d1/d1/d1"), Path("/test/d1/d2"), Path("/test/d1/d3"), Path("/test/d1/d1/d2"), ] ) | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/core/test_walker.py | test_location | assert | collection | 20 | from collections import Counter
from pathlib import Path
import pytest
from pyfakefs.fake_filesystem import FakeFilesystem
from organize.walker import Walker
def counter(items):
return Counter(str(x) for x in items)
def test_location(fs):
fs.create_file("test/folder/file.txt")
fs.create_file("test/folde... | [ Path("test/folder/file.txt"), Path("test/folder/subfolder/another.pdf"), Path("test/hi/there"), Path("test/hi/.other"), Path("test/.hidden/some.pdf"), ] | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/core/test_walker.py | test_location | assert | collection | 27 | from collections import Counter
from pathlib import Path
import pytest
from pyfakefs.fake_filesystem import FakeFilesystem
from organize.walker import Walker
def counter(items):
return Counter(str(x) for x in items)
def test_location(fs):
fs.create_file("test/folder/file.txt")
fs.create_file("test/folde... | [ Path("test/folder/subfolder/another.pdf"), Path("test/folder/file.txt"), Path("test/hi/there"), Path("test/hi/.other"), Path("test/.hidden/some.pdf"), ] | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/filters/test_duplicate.py | test_duplicate_largefiles | assert | collection | 36 | from conftest import make_files, read_files
from organize import Config
CONTENT_SMALL = "COPY CONTENT"
CONTENT_LARGE = "XYZ" * 300000
CONFIG_DEEP_DUP_DELETE = """
rules:
- locations: "."
subfolders: true
filters:
- duplicate:
detect_original_by: name
actions:
- delete
"""
def tes... | { "unique.txt": CONTENT_LARGE + "1", "unique_too.txt": CONTENT_LARGE + "2", "a.txt": CONTENT_LARGE, "other": {}, } | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/filters/test_duplicate.py | test_duplicate_smallfiles | assert | collection | 37 | from conftest import make_files, read_files
from organize import Config
CONTENT_SMALL = "COPY CONTENT"
CONTENT_LARGE = "XYZ" * 300000
CONFIG_DEEP_DUP_DELETE = """
rules:
- locations: "."
subfolders: true
filters:
- duplicate:
detect_original_by: name
actions:
- delete
"""
def tes... | { "unique.txt": "I'm unique.", "unique_too.txt": "I'm unique: too.", "a.txt": CONTENT_SMALL, "other": { "large.txt": CONTENT_LARGE, }, } | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/filters/test_exif.py | test_exif_read_camera | assert | variable | 36 | 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 | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/filters/test_exif.py | test_exif_filter_by_cam | assert | string_literal | 36 | 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" | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/filters/test_exif.py | test_exif_filter_by_multiple_keys | assert | func_call | 34 | 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... | set(["3.jpg", "4.jpg"]) | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/filters/test_exif.py | test_exif_filter_tag_exists_and_date_format | assert | func_call | 36 | 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... | set( [ "3: 12.08.2017", "4: 22.02.2018", "5: 08.07.2015", ] ) | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
tfeldmann/organize | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | train | train | tests/filters/test_extension.py | test_extension | assert | variable | 23 | 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 | 64b9667eb315c33305e12dc5a6fd7290fe979b29 | 84 | v2_extractor_at_anchor |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.