Skip to content

Commit 60a4fc8

Browse files
syxolkgfyoung
authored andcommitted
Add test cases with 1 and 3 columns
1 parent 6cd4145 commit 60a4fc8

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
@@ -400,6 +400,14 @@ def test_to_latex_longtable(self, frame):
400400

401401
assert withoutindex_result == withoutindex_expected
402402

403+
df = DataFrame({'a': [1, 2]})
404+
with1column_result = df.to_latex(index=False, longtable=True)
405+
assert "\multicolumn{1}" in with1column_result
406+
407+
df = DataFrame({'a': [1, 2], 'b': [3, 4], 'c': [5, 6]})
408+
with3columns_result = df.to_latex(index=False, longtable=True)
409+
assert "\multicolumn{3}" in with3columns_result
410+
403411
def test_to_latex_escape_special_chars(self):
404412
special_characters = ['&', '%', '$', '#', '_', '{', '}', '~', '^',
405413
'\\']

0 commit comments

Comments
 (0)