def test_serialize_filename_strips_illegal_symbols_positive_win32(): filename = 'Test file name ([{~`!@#$%^&*()_+|?><\'"}])?.txt' serialized_name, modified = fs_util.serialize_filename(filename) assert modified is True if sys.platform[:3] == "win": assert serialized_name == 'Test file name ([{~`!@#$^&()_+\'}]).txt' else: assert serialized_name == 'Test file name ([{~`!@#$%^&()_+\'}]).txt'
def test_serialize_filename_does_not_strip_three_bytes_symbols_positive(): filename = '漢語' serialized_name, modified = fs_util.serialize_filename(filename) assert modified is False assert serialized_name == filename
def test_serialize_filename_strips_four_bytes_symbols_positive(): filename = 'filename with 👀 eyes 👀' serialized_name, modified = fs_util.serialize_filename(filename) assert modified is True assert serialized_name == 'filename with eyes '
def test_serialize_filename_strips_dots_positive(): filename = '.filename.txt.' serialized_name, modified = fs_util.serialize_filename(filename) assert modified is True assert serialized_name == 'filename.txt'
def test_serialize_filename_strips_illegal_symbols_positive_osx(): filename = 'Test file name ([{~`!@#$%^&*()_+|?><\'"}])?.txt' serialized_name, modified = fs_util.serialize_filename(filename) assert modified is True assert serialized_name == 'Test file name ([{~`!@#$%^&*()_+?><\'"}])?.txt'