def test_result_is_binary(self): # Result should be a stream with a binary type res = csvlib.rows_as_csv_file([['foo']]) assert isinstance(next(res), six.binary_type)
def append_rows(self, ds, rows): """Append the given rows of Python values. Return the new Batch.""" f = csvlib.rows_as_csv_file(rows) return self.append_csv_string(ds, f)
def test_unicode_values(self): # CSV rendering should handle simple unicode rows = [['☃']] csvlib.rows_as_csv_file(rows)
def test_result_is_binary(self): "Result should be a stream with a binary type" res = csvlib.rows_as_csv_file([['foo']]) assert isinstance(next(res), six.binary_type)
def test_unicode_values(self): "CSV rendering should handle simple unicode" rows = [['☃']] csvlib.rows_as_csv_file(rows)
def test_rows_as_csv_file(self): # None should be emitted as an empty cell (unquoted) rows = [[0, 1, None, "bananas"]] fp = csvlib.rows_as_csv_file(rows) self.assertEqual(fp.read(), b'0,1,,"bananas"\n')