-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TST: Fix for doctest in style_render.py -> pandas.io.formats.style_re… #42778
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TST: Fix for doctest in style_render.py -> pandas.io.formats.style_re… #42778
Conversation
…nder.StylerRenderer.format
is it better to have two spaces before |
pandas/io/formats/style_render.py
Outdated
@@ -698,7 +700,7 @@ def format( | |||
Using a ``formatter`` with LaTeX ``escape``. | |||
|
|||
>>> df = pd.DataFrame([["123"], ["~ ^"], ["$%#"]]) | |||
>>> s = df.style.format("\\textbf{{{}}}", escape="latex").to_latex() | |||
>>> s = df.style.format("\\textbf{{{}}}", escape="latex").to_latex() # doctest: +SKIP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to_latex()
actually produces a string result.. maybe this could be doctested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The command line output I got by running this test is not pretty printed actually as it is in the docs, thus failing the doctest:
________ [doctest] pandas.io.formats.style_render.StylerRenderer.format ________
694 ...
695 <td .. ><a href="a.com/<div></div>"><div></div></a></td>
696 <td .. ><a href="a.com/"A&B"">"A&B"</a></td>
697 <td .. >NA</td>
698 ...
699
700 Using a ``formatter`` with LaTeX ``escape``.
701
702 >>> df = pd.DataFrame([["123"], ["~ ^"], ["$%#"]])
703 >>> df.style.format("\\textbf{{{}}}", escape="latex").to_latex()
Expected:
\begin{tabular}{ll}
{} & {0} \\
0 & \textbf{123} \\
1 & \textbf{\textasciitilde \space \textasciicircum } \\
2 & \textbf{\$\%\#} \\
\end{tabular}
Got:
'\\begin{tabular}{ll}\n{} & {0} \\\\\n0 & \\textbf{123} \\\\\n1 & \\textbf{\\textasciitilde \\space \\textasciicircum } \\\\\n2 & \\textbf{\\$\\%\\#} \\\\\n\\end{tabular}\n'
Please let me know if I am missing something here.
Thanks.
Sorry actually I have added two spaces before |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, all of these can be skipped
Thanks |
Hi @KrishnaSai2020. Thank you for this. |
thanks @aneesh98 |
TST: Fix for doctest in style_render.py (pandas-dev#42778)
* TST: Fix for doctest in style_render.py -> pandas.io.formats.style_render.StylerRenderer.format * Fixed PEP8 Issues * Fixed Whitespace & Longline PEP8 issues
This pull request fixes the doctest pandas.io.formats.style_render.StylerRenderer.format
Following this commit, all the doctests in style_render.py file passed.
Output: