BUG: Series.where not casting None to nan by jbrockmendel · Pull Request #39761 · pandas-dev/pandas (original) (raw)

What the general rationale to decide which tests go in /tests/indexing and which in /tests/series/indexing ?

Some of this is laid out in test_writing.rst. There is no doubt room for improvement in that file if you have suggestions.

The over-arching MO is to organize indexing tests by method. So anything for Series.__setitem__ would go in tests/series/indexing/test_setitem.py. Under this theory, all of tests(/frame|/series)?/indexing/test_indexing.py files and all of the tests(/frame|/series)?/indexing/test_{dtype}.py files would eventually have their tests moved to a method-specific file. Many of the remaining tests in these files are hard to categorize as being for a single method, so do not (yet?) conform to this pattern.

The MO specific to this PR and recent similar ones is to get more Series.__setitem__ tests to use SetitemCastingEquivalents which is proving very useful for finding inconsistencies. This cuts against the method-specific organization so the final location of it may be reconsidered at some point.

I expect we will either extend SetitemCastingEquivalents to include DataFrame cases or implement similar classes that handle cases SetitemCastingEquivalents can't.