Skip to content

DOC: test organization #37760

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

Merged
merged 15 commits into from
Nov 14, 2020
Merged

DOC: test organization #37760

merged 15 commits into from
Nov 14, 2020

Conversation

jbrockmendel
Copy link
Member

Retry of #37637, reverted by #37756

@simonjayhawkins simonjayhawkins added Docs Testing pandas testing functions or related to the test suite labels Nov 11, 2020
@simonjayhawkins simonjayhawkins added this to the 1.2 milestone Nov 11, 2020
@jbrockmendel
Copy link
Member Author

@jorisvandenbossche thoughts on the rst?

Copy link
Member

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't look yet at the actual content, but a few comments on the rest markup (I commented mostly on the first bullet point, but it needs to be fixed for the full file, to be clear)

be located.

1. Does your test depend only on code in ``pd._libs.tslibs``?
This test likely belongs in one of:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line needs to be aligned with the "Does .." from the line above. See eg https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#lists-and-quote-like-blocks for rst syntax for lists (and nested lists)

1. Does your test depend only on code in ``pd._libs.tslibs``?
This test likely belongs in one of:

- tests.tslibs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also needs to be aligned with the "Does .." from the first line of this bullet point (the doc link I gave above also has an example of nested lists)


- tests.tslibs

.. note::
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This note is part of the "tests.tslibs" text block, so the start of this (the ..) needs to align with "tests.tslibs"

In cases like this, the test location should be based on the *underlying* method being tested. Or in the case of a test for a bugfix, the location of the actual bug. So in this example, we know that ``Series.__getitem__`` calls ``Series.loc.__getitem__``, so this is *really* a test for ``loc.__getitem__``. So this test belongs in ``tests.indexing.test_loc``

6. Is your test for a DataFrame or Series method?
A) Is the method a plotting method?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When starting a sub-item (the A) list item), there needs to be a blank line preceding it to make the separation with the previous (parent) item clear

result = ser.loc[[3, 4]]
tm.assert_series_equal(result, expected)

In cases like this, the test location should be based on the *underlying* method being tested. Or in the case of a test for a bugfix, the location of the actual bug. So in this example, we know that ``Series.__getitem__`` calls ``Series.loc.__getitem__``, so this is *really* a test for ``loc.__getitem__``. So this test belongs in ``tests.indexing.test_loc``
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you hard-wrap those lines?

@jbrockmendel
Copy link
Member Author

@jorisvandenbossche thanks for the notes, implementing them now

@jreback jreback merged commit 3d77db7 into pandas-dev:master Nov 14, 2020
@jreback
Copy link
Contributor

jreback commented Nov 14, 2020

thanks @jbrockmendel

merging this, will likely be updating as we go so if more comments can handle then.

@jbrockmendel jbrockmendel deleted the doc-testorg branch November 14, 2020 03:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants