80a5690740
Ruff: The remaining I001 errors came from ruff treating `alembic` as a first- party module (because the alembic/ directory exists in the repo root) rather than third-party. Ran `ruff check --fix` locally — auto-sorted import groupings to put alembic/sqlalchemy alongside backend.* as first- party, and trimmed redundant blank lines after a few import blocks. Frontend: `npm run check` (vue-tsc --noEmit) was failing because vue-tsc has no tsconfig.json to read against, and the frontend is pure JS without JSDoc annotations — vue-tsc had nothing to do. Skipping the step until we add a tsconfig + convert to TS or add JSDoc annotations. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
43 lines
1.1 KiB
Python
43 lines
1.1 KiB
Python
from pathlib import Path
|
|
|
|
from backend.app.utils.paths import (
|
|
derive_subdir,
|
|
derive_top_level_artist,
|
|
hash_suffixed_name,
|
|
)
|
|
|
|
IMPORT = Path("/import")
|
|
|
|
|
|
def test_derive_subdir_nested():
|
|
assert derive_subdir(Path("/import/Alice/sub/x.png"), IMPORT) == "Alice/sub"
|
|
|
|
|
|
def test_derive_subdir_one_level():
|
|
assert derive_subdir(Path("/import/Alice/x.png"), IMPORT) == "Alice"
|
|
|
|
|
|
def test_derive_subdir_root():
|
|
assert derive_subdir(Path("/import/x.png"), IMPORT) == ""
|
|
|
|
|
|
def test_derive_subdir_outside_root():
|
|
assert derive_subdir(Path("/elsewhere/x.png"), IMPORT) == ""
|
|
|
|
|
|
def test_hash_suffixed_name():
|
|
h = "abcdef1234567890" + "0" * 48
|
|
assert hash_suffixed_name("photo", h, ".png") == "photo__abcdef1234.png"
|
|
|
|
|
|
def test_derive_top_level_artist_present():
|
|
assert derive_top_level_artist(Path("/import/Alice/x.png"), IMPORT) == "Alice"
|
|
|
|
|
|
def test_derive_top_level_artist_nested():
|
|
assert derive_top_level_artist(Path("/import/Alice/sub/x.png"), IMPORT) == "Alice"
|
|
|
|
|
|
def test_derive_top_level_artist_root():
|
|
assert derive_top_level_artist(Path("/import/x.png"), IMPORT) is None
|