Skip to content

Commit adba9ca

Browse files
committed
fix test
1 parent a1c6275 commit adba9ca

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

pandas/tests/io/formats/test_to_latex.py

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -825,26 +825,18 @@ def test_to_latex_escape_special_chars(self):
825825
assert result == expected
826826

827827
def test_to_latex_escape_special_chars_in_index_names(self):
828-
special_characters = ["&", "%", "$", "#", "_", "{", "}", "~", "^", "\\"]
829-
df = DataFrame([special_characters, special_characters]).T.set_index(0)
828+
index = "&%$#_{}}~^\\"
829+
df = DataFrame({index: [1, 2, 3]}).set_index(index)
830830
result = df.to_latex(escape=True)
831831
expected = _dedent(
832832
r"""
833-
\begin{tabular}{ll}
833+
\begin{tabular}{l}
834834
\toprule
835-
& 1 \\
836-
0 & \\
837-
\midrule
838-
\& & \& \\
839-
\% & \% \\
840-
\$ & \$ \\
841-
\# & \# \\
842-
\_ & \_ \\
843-
\{ & \{ \\
844-
\} & \} \\
845-
\textasciitilde & \textasciitilde \\
846-
\textasciicircum & \textasciicircum \\
847-
\textbackslash & \textbackslash \\
835+
\&\%\$\#\_\{\}\}\textasciitilde \textasciicircum \textbackslash \\
836+
\midrule
837+
1 \\
838+
2 \\
839+
3 \\
848840
\bottomrule
849841
\end{tabular}
850842
"""

0 commit comments

Comments
 (0)