wolkje-gedeelde-mappen/tests/test_file_name.py

15 lines
543 B
Python
Raw Normal View History

2023-05-02 17:38:05 +02:00
#!/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