14 lines
543 B
Python
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
|