-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TST: Fix doctest in _parse_latex_table_styles #42674
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
Comments
I'll start to see this problem, ok? |
Sure, if you write |
take |
@datapythonista thanks for the tip. |
Hi @Leonardofreua, I hope you are doing well. I just wanted to ask you, if its okay with you if I work on this issue? because the doctest mentioned in this issue is failing ci checks in my pull request #42700. Also if you are in the process of solving this issue and going to make PR for the same, please let me know, I won't take up this issue then, no problem. Do let me know. |
Hi @aneesh98 , I hope you are doing well too. I'm working on some doctests yes, but what do you think about releasing a PR just fixing the doctests that are failing their PR? Then I launch another one correcting the missing ones. |
Hi @Leonardofreua , I am doing well, thanks for asking. Actually this particular doctest mentioned in this issue is failing in the CI Check of my pull request, so thats why I am asking if its okay with you if I go ahead with solving this particular case and include its solution in my PR? |
@aneesh98 you can proceed without any problem. |
Hi, @datapythonista I hope you are doing well. I would like to confirm a small detail with you for the scenario where the only alternative is to use In the case of applied styles that result in a cell or background color changing, these could also receive Example:
Or is there an alternative to show these changed results? |
Good point. There are different alternatives. First is to show that code, but not generating an output, for example with Then, you can use |
@datapythonista I'm going to try some of the suggestions you gave. But I ended up finding the documentation for the This way the documentation makes it very clear what will happen when running the code. |
We need the tests to pass, so we don't have errors in our examples, but what's important is that the documentation is useful for users. Didn't check this example in detail, but what you propose seems like a good idea. Thanks! |
tl;dr
Fix the next doctest error:
Detailed instructions
Python allows to have example code in the documentation, like in:
In pandas, we use this to document most elements. And there are tools, like pytest,
that can run the examples, and make sure everything is correct.
For historical reasons, we have many examples where the code fails to run, or the
actual output is different from the expected output. For example, check the next
incorrect examples:
All them will fail for different reasons. To test the docstring of an object,
the next command can be run:
Where
pandas/core/frame.py
is the file where the docstring is defined, andpandas.core.frame.DataFrame.info
is the object. A whole file can also be testedby removing the
::
and the object from the command above.In general, the errors in the examples can be fixed with things like:
df
is used, butno sample dataset
df
has been first defined)For example, a function that connects to a private webservice. In
such cases, we can add
# doctest: +SKIP
at the end of the linesthat should not run
To be able to properly fix an example for the first time, the next steps
are needed:
simplified instructions in this page,
and more detailed information in pandas official contributing page.
and make sure the examples are still broken in the
master
branch ofpandas
fix is working as expected
follow PEP-8, and fix the style if it doesn't
request. Make sure you edit the line
Closes #XXXX
with the issuenumber you are addressing, so the issue is automatically closed,
when the pull request is merged
in green. If it doesn't, check if the problem is in your changes
(sometimes things break in master for technical problems, and in
that case you just need to wait for a core developer to fix the
problem)
commit, and push to your branch, no need to open new pull requests)
The text was updated successfully, but these errors were encountered: