コード例 #1
0
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'
コード例 #2
0
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
コード例 #3
0
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  '
コード例 #4
0
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'
コード例 #5
0
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'