|
3 | 3 | from unittest import TestCase
|
4 | 4 |
|
5 | 5 | import pyexcel_io.manager as manager
|
| 6 | +from pyexcel_io import get_data |
6 | 7 | from pyexcel_io.sheet import NamedContent
|
7 | 8 | from pyexcel_io.reader import EncapsulatedSheetReader
|
8 | 9 | from pyexcel_io._compact import BytesIO, StringIO
|
@@ -115,6 +116,18 @@ def test_sheet_file_reader(self):
|
115 | 116 | result = list(r.to_array())
|
116 | 117 | self.assertEqual(result, [[1], [4, 5, 6], ["", 7]])
|
117 | 118 |
|
| 119 | + def test_sheet_file_reader_with_trailing_empty_cells(self): |
| 120 | + r = EncapsulatedSheetReader( |
| 121 | + CSVFileReader(NamedContent(self.file_type, self.test_file)), |
| 122 | + keep_trailing_empty_cells=True, |
| 123 | + ) |
| 124 | + result = list(r.to_array()) |
| 125 | + self.assertEqual(result, [[1], [4, 5, 6, "", ""], ["", 7]]) |
| 126 | + |
| 127 | + def test_get_data_with_trailing_empty_cells(self): |
| 128 | + result = get_data(self.test_file, keep_trailing_empty_cells=True) |
| 129 | + self.assertEqual(result[self.test_file], [[1], [4, 5, 6, "", ""], ["", 7]]) |
| 130 | + |
118 | 131 | def tearDown(self):
|
119 | 132 | os.unlink(self.test_file)
|
120 | 133 |
|
|
0 commit comments