def test_writerows(self): output = six.StringIO() writer = csv_py3.Writer(output) writer.writerows([['a', 'b', 'c'], ['1', '2', '3'], ['4', '5', u'ʤ']]) written = six.StringIO(output.getvalue()) reader = csv_py3.Reader(written) self.assertEqual(next(reader), ['a', 'b', 'c']) self.assertEqual(next(reader), ['1', '2', '3']) self.assertEqual(next(reader), ['4', '5', u'ʤ'])
def test_line_numbers(self): output = six.StringIO() writer = csv_py3.Writer(output, line_numbers=True) writer.writerow(['a', 'b', 'c']) writer.writerow(['1', '2', '3']) writer.writerow(['4', '5', u'ʤ']) written = six.StringIO(output.getvalue()) reader = csv_py3.Reader(written) self.assertEqual(next(reader), ['line_number', 'a', 'b', 'c']) self.assertEqual(next(reader), ['1', '1', '2', '3']) self.assertEqual(next(reader), ['2', '4', '5', u'ʤ'])