Changeset 1609:5065ec7ab12f


Ignore:
Timestamp:
Nov 22, 2015, 5:48:53 PM (5 years ago)
Author:
Stefan Schwarzer <sschwarzer@…>
Branch:
default
Message:
Remove test `TestOther.test_bytes_file_name`

This test is superseded by `test_listdir_with_non_ascii_byte_string`
and `test_listdir_with_non_ascii_unicode_string`.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/test_real_ftp.py

    r1608 r1609  
    811811        self.assertRaises(ftputil.error.TimeShiftError, host.synchronize_times)
    812812
    813     def test_bytes_file_name(self):
    814         """
    815         Test whether a UTF-8 file name can be sent and retrieved when
    816         encoded explicitly.
    817         """
    818         host = self.host
    819         # This requires an existing file with an UTF-8 encoded name on
    820         # the remote file system. Note: If the remote file system
    821         # doesn't use UTF-8, the test will probably succeed anyway.
    822         FILE_NAME = "_ütf8_file_näme_♯♭_"
    823         bytes_file_name = FILE_NAME.encode("UTF-8")
    824         self.cleaner.add_file(bytes_file_name)
    825         # Write under name `bytes_file_name`. The content is rather
    826         # irrelevant.
    827         with host.open(bytes_file_name, "w", encoding="UTF-8") as fobj:
    828             fobj.write(FILE_NAME)
    829         # Try to retrieve file with `listdir`.
    830         items = host.listdir(b".")
    831         self.assertTrue(bytes_file_name in items)
    832         #  When getting a directory listing for a unicode directory,
    833         #  ftputil will implicitly assume the encoding is latin-1 and
    834         #  won't decode the file name to something different from
    835         #  `bytes_file_name`.
    836         items = host.listdir(".")
    837         self.assertFalse(FILE_NAME in items)
    838         # Re-open file.
    839         with host.open(bytes_file_name, "r", encoding="UTF-8") as fobj:
    840             data = fobj.read()
    841         # Not the point of this test, but an additional sanity check
    842         self.assertEqual(data, FILE_NAME)
    843 
    844813    def test_listdir_with_non_ascii_byte_string(self):
    845814        """
Note: See TracChangeset for help on using the changeset viewer.