Ejemplo n.º 1
0
 def test5_file_read(self):
     'QueueBase._file_read()'
     text = 'hello\n'.encode()
     open(self.tempfile, 'wb').write(text)
     text_in = QueueBase._file_read(self.tempfile, False)
     self.assertEqual(text, text_in)
     # utf8
     try:
         text = 'Élément \u263A\n'.decode("utf-8")
     except AttributeError:
         text = 'Élément \u263A\n'
     codecs.open(self.tempfile, 'w', 'utf8').write(text)
     text_in = QueueBase._file_read(self.tempfile, True)
     self.assertEqual(text, text_in)
Ejemplo n.º 2
0
 def test5_file_read(self):
     'QueueBase._file_read()'
     text = 'hello\n'.encode()
     open(self.tempfile, 'wb').write(text)
     text_in = QueueBase._file_read(self.tempfile, False)
     self.assertEqual(text, text_in)
     # utf8
     try:
         text = 'Élément \u263A\n'.decode("utf-8")
     except AttributeError:
         text = 'Élément \u263A\n'
     codecs.open(self.tempfile, 'w', 'utf8').write(text)
     text_in = QueueBase._file_read(self.tempfile, True)
     self.assertEqual(text, text_in)