Exemple #1
0
 def test_csv_file_writer_int(self):
     writer = CsvFileWriter()
     headers = [100, 'spam', 'eggs']
     writer.open('Spam')
     writer.write_row(headers)
     writer.finish()
     file_start = writer.get_file().read(6)
     self.assertEqual(file_start, BOM_UTF8 + b'100')
Exemple #2
0
 def test_csv_file_writer_utf8(self):
     writer = CsvFileWriter()
     headers = ['hám', 'spam', 'eggs']
     writer.open('Spam')
     writer.write_row(headers)
     writer.finish()
     file_start = writer.get_file().read(7)
     self.assertEqual(file_start, BOM_UTF8 + 'hám'.encode('utf-8'))
Exemple #3
0
 def test_csv_file_writer_int(self):
     writer = CsvFileWriter()
     headers = [100, 'spam', 'eggs']
     writer.open('Spam')
     writer.write_row(headers)
     writer.finish()
     file_start = writer.get_file().read(6)
     self.assertEqual(file_start, BOM_UTF8 + b'100')
Exemple #4
0
 def test_csv_file_writer_utf8(self):
     writer = CsvFileWriter()
     headers = ['hám', 'spam', 'eggs']
     writer.open('Spam')
     writer.write_row(headers)
     writer.finish()
     file_start = writer.get_file().read(7)
     self.assertEqual(file_start, BOM_UTF8 + 'hám'.encode('utf-8'))
Exemple #5
0
 def test_csv_file_writer_bom(self):
     """
     CsvFileWriter should prepend a byte-order mark to the start of the CSV file for Excel
     """
     writer = CsvFileWriter()
     headers = ['ham', 'spam', 'eggs']
     writer.open('Spam')
     writer.write_row(headers)
     writer.finish()
     file_start = writer.get_file().read(6)
     self.assertEqual(file_start, BOM_UTF8 + b'ham')
Exemple #6
0
 def test_csv_file_writer_bom(self):
     """
     CsvFileWriter should prepend a byte-order mark to the start of the CSV file for Excel
     """
     writer = CsvFileWriter()
     headers = ['ham', 'spam', 'eggs']
     writer.open('Spam')
     writer.write_row(headers)
     writer.finish()
     file_start = writer.get_file().read(6)
     self.assertEqual(file_start, BOM_UTF8 + 'ham')