Strip emojis from filenames on Windows (#222)

This commit is contained in:
Serene
2021-03-27 21:14:08 +10:00
committed by Ali Parlakci
parent 20f525bd0d
commit f2946c0a87
2 changed files with 18 additions and 0 deletions

View File

@@ -188,12 +188,24 @@ def test_shorten_filenames(tmp_path: Path):
@pytest.mark.parametrize(('test_string', 'expected'), (
('test', 'test'),
('test😍', 'test'),
('test.png', 'test.png'),
('test*', 'test'),
('test**', 'test'),
('test?*', 'test'),
('test_???.png', 'test_.png'),
('test_???😍.png', 'test_.png'),
))
def test_format_file_name_for_windows(test_string: str, expected: str):
result = FileNameFormatter._format_for_windows(test_string)
assert result == expected
@pytest.mark.parametrize(('test_string', 'expected'), (
('test', 'test'),
('test😍', 'test'),
('😍', ''),
))
def test_strip_emojies(test_string: str, expected: str):
result = FileNameFormatter._strip_emojis(test_string)
assert result == expected