4cb319b393
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>
26 lines
517 B
Python
26 lines
517 B
Python
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"
|