wolkje-gedeelde-mappen/tests/test_file_name.py
Midgard 9784205759
Drop extension overriding
Just check that the extension is valid.
2023-05-02 18:30:32 +02:00

14 lines
543 B
Python

#!/usr/bin/env python3
from wolkje_files import file_name
def test_sanitize():
assert file_name.sanitize("foo.jpg") == "foo.jpg"
assert file_name.sanitize("foo/bar.jpg") == "foo-bar.jpg"
assert file_name.sanitize("foo bar (1).jpg") == "foo bar (1).jpg"
assert file_name.sanitize("foo/bar (1).jpg") == "foo-bar (1).jpg"
assert file_name.sanitize(".foo/bar (1).jpg") == "foo-bar (1).jpg"
assert file_name.sanitize("..foo/bar (1).jpg") == "foo-bar (1).jpg"
assert file_name.sanitize("..") is None
assert file_name.sanitize("") is None