Changeset 123

Show
Ignore:
Timestamp:
2002-03-30 17:44:11 (7 years ago)
Author:
schwa
Message:
TestFileOperations: converted method ascii_write to test_ascii_write.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/_test_ftputil.py

    r121 r123  
    3030# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
    3131 
    32 # $Id: _test_ftputil.py,v 1.35 2002/03/30 17:37:29 schwa Exp $ 
     32# $Id: _test_ftputil.py,v 1.36 2002/03/30 17:44:11 schwa Exp $ 
    3333 
    3434import unittest 
     
    241241        child_data = host.file_content_for_child(0) 
    242242        file.close() 
    243         self.assertEqual(data, expected_data) 
    244  
    245 #     def ascii_write(self): 
    246 #         """Write an ASCII text to the host and check the written file.""" 
    247 #         host = self.host 
    248 #         local_data = ' \nline 2\nline 3' 
    249 #         # write data in ASCII mode 
    250 #         self.write_test_data(local_data, 'w') 
    251 #         # read data back in binary mode 
    252 #         input_ = host.file(self.remote_name, 'rb') 
    253 #         remote_data = input_.read() 
    254 #         input_.close() 
    255 #         # expect the same data as above if we have a 
    256 #         #  Unix FTP server 
    257 #         self.assertEqual(local_data, remote_data) 
    258 
     243        self.assertEqual(child_data, expected_data) 
     244 
     245    def test_ascii_write(self): 
     246        """Write an ASCII text to the host and check the written file.""" 
     247        host = ftp_host_factory() 
     248        data = ' \nline 2\nline 3' 
     249        expected_data = ' \r\nline 2\r\nline 3' 
     250        file = host.file('dummy', 'w') 
     251        file.write(data) 
     252        child_data = host.file_content_for_child(0) 
     253        file.close() 
     254        self.assertEqual(child_data, expected_data) 
     255 
    259256#     def ascii_writelines(self): 
    260257#         """Write data via writelines and read it back."""