def test_writer_netascii_mode(self): self._test_writer_netascii_mode(netascii.encode(LOREM_IPSUM[300:])) self._test_writer_netascii_mode(netascii.encode(LOREM_IPSUM[512:])) self._test_writer_netascii_mode(netascii.encode(LOREM_IPSUM))
def _test_reader_netascii_mode(self, data): fname = write_temp_file(data) fr = TftpFileReader(fname, 'netascii') self.assertEqual(read_whole_file(fr), netascii.encode(data)) self.assertTrue(fr._file.closed) os.remove(fname)