-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TST: move and reformat latex_na_rep test #37717
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
Conversation
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
columns=["Group", "Data"], | ||
) | ||
result = df.to_latex(na_rep=na_rep, float_format="{:.2f}".format) | ||
expected = _dedent( |
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.
Nice. I think this same pattern appears in other places, could push this definition higher up and use elsewhere?
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.
Do you mean _dedent
(without the preceding newline?)
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.
Ah, maybe the other cases aren't using the preceding newline so could probably use dedent alone for those
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.
Here I used custom _dedent
only to make it compatible with raw strings.
In general I would simply use this
dedent(
"""\
content
"""
)
I guess that raw strings are mostly present here, in latex-related tests, because of the number of backslashes.
In other places we may want to use just built-in dedent
thanks @ivanovmg |
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff
Move test to a more suitable location (
class TestToLatexFormatters
)and reformat using
_dedent
and raw string for better readability.