feat(fc2a): add slug and paths utilities
slugify() produces ASCII-only lowercase slugs from arbitrary text (used for artist slugs and tag slugs). paths.derive_subdir/derive_top_level_artist extract the destination layout and folder→artist convention from an import source path. hash_suffixed_name builds IR-style 'stem__hash10.ext' filenames. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
from backend.app.utils.slug import slugify
|
||||
|
||||
|
||||
def test_slugify_basic():
|
||||
assert slugify("Bob Ross") == "bob-ross"
|
||||
|
||||
|
||||
def test_slugify_punctuation():
|
||||
assert slugify("hello, world!") == "hello-world"
|
||||
|
||||
|
||||
def test_slugify_unicode():
|
||||
assert slugify("naïve café") == "naive-cafe"
|
||||
|
||||
|
||||
def test_slugify_empty():
|
||||
assert slugify("") == "untitled"
|
||||
|
||||
|
||||
def test_slugify_only_punctuation():
|
||||
assert slugify("!!!") == "untitled"
|
||||
|
||||
|
||||
def test_slugify_leading_trailing_spaces():
|
||||
assert slugify(" Alice ") == "alice"
|
||||
Reference in New Issue
Block a user