Skip to content

Commit 23fc5d3

Browse files
committed
Add test cases with 1 and 3 columns
1 parent 7a71573 commit 23fc5d3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pandas/tests/io/formats/test_to_latex.py

+8
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,14 @@ def test_to_latex_longtable(self, frame):
378378

379379
assert withoutindex_result == withoutindex_expected
380380

381+
df = DataFrame({'a': [1, 2]})
382+
with1column_result = df.to_latex(index=False, longtable=True)
383+
assert "\multicolumn{1}" in with1column_result
384+
385+
df = DataFrame({'a': [1, 2], 'b': [3, 4], 'c': [5, 6]})
386+
with3columns_result = df.to_latex(index=False, longtable=True)
387+
assert "\multicolumn{3}" in with3columns_result
388+
381389
def test_to_latex_escape_special_chars(self):
382390
special_characters = ['&', '%', '$', '#', '_', '{', '}', '~', '^',
383391
'\\']

0 commit comments

Comments
 (0)