TST: fixturize series/test_alter_axes.py
State: closed

- [x] prep for #22225, in the sense that it preempts (and splits off) the test-related changes that have been required on the DataFrame-side of the PR (see  #22236)
- [x] tests modified / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`

In particular, it takes the fixture-like attributes of `tests/series/common.TestData` and transforms them into fixtures in `tests/series/conftest.py`, with the eventual goal of replacing all the `TestData`-attributes in the Series tests, similar to #22471 (I can also open a sister issue to that for the Series tests).

Labels:
name: Testing
description: pandas testing functions or related to the test suite

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/22526?src=pr&el=h1) Report
> Merging [#22526](https://codecov.io/gh/pandas-dev/pandas/pull/22526?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/f82c10ab4741b274b55c327362c1f3aec29fbde9?src=pr&el=desc) will **increase** coverage by `<.01%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/22526/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/22526?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #22526      +/-   ##
==========================================
+ Coverage   92.04%   92.04%   +<.01%     
==========================================
  Files         169      169              
  Lines       50782    50782              
==========================================
+ Hits        46742    46744       +2     
+ Misses       4040     4038       -2
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.45% <ø> (ø)` | :arrow_up: |
| #single | `42.31% <ø> (ø)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/22526?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/22526/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `85.96% <0%> (+0.2%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/22526?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/22526?src=pr&el=footer). Last update [f82c10a...4270363](https://codecov.io/gh/pandas-dev/pandas/pull/22526?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

@jreback 
> can you add doc-strings and meaningful names for these. (e.g. ts -> datetime_series)

This is the same issue as in #22236 - these "fixture-like" `TestData`-attributes will need to be replaced in all Series tests, and renaming them now will make it harder to simply replace them (e.g. if someone were to work on a different module, to know that `self.series` needs to be replaced with `string_series`).

One possible approach to satisfy both demands would be to open up a sister issue to #22471 for Series, and have a "translation guide" like
* `self.ts` -> `datetime_series`
* `self.series` -> `string_series`
* `self.objSeries` -> `object_series`
* `self.empty` -> `empty_series`

The same approach could be applied to #22236 / #22471 if you're unhappy with the fixture names coming from `TestData` there (cc @gfyoung).
@jreback

I added the "translations" as requested - it's gonna make transitioning the other modules a fair bit harder, but for only four fixtures, I think it's doable.
Hello @h-vetinari! Thanks for updating the PR.





Cheers ! There are no PEP8 issues in this Pull Request. :beers: 

##### Comment last updated on August 31, 2018 at 13:49 Hours UTC
@jreback 

All green. This is very similar to #22236 - can I please ask you to take a look there again? I incorporated all your feedback (fixturize, split off warnings into new PR, etc.), and don't know what's left to do - it's been a very drawn-out process to eke out further instructions for what could have been a simple test clean-up.

Based on this review here, I now also added docstrings to the fixtures there; I didn't rename them yet (but added a note in each fixture), because otherwise the fixturization of the other modules would be that much harder (and it's much easier to run a simple search and replace once everything is translated, i.e. #22471 is done).
it’s long and drawn out because the PRs have too much unrelated changes in them

1 thing per PR will get u merged much faster with less comments 

even things as simple as changing unrelated whatsnew notes

the more code the more i have to go over with a fine toothed comb 

further responding to my comments with further questions - while for sure ask if things are unclear
can certainly make things take longer
@jreback 

For sure, and I appreciate the effort you put in. But I've learned my lesson about the unrelated changes, and I've been splitting them into smaller and smaller pieces.

In #22236, the "unrelated" changes were - respectfully - mostly your requests at cleaning up things not directly related to the PR (except that it was in the same module), and I split off the new warnings as requested as well. The diffs of the last few commits are not very large at all (except the added docstrings now, which I'll happily revert if not necessary) - e.g. starting after your last review: ```https://github.com/pandas-dev/pandas/pull/22236/commits/9121d4912cdcd7f8a7e3336fc385bf00ccab93ad```
@jreback anything left to do on this? Someone wants to already start working on fixturising the rest of the series tests, see #22550
@jreback 

> @h-vetinari the pings are fine, but if someone wants to work on things based on this nothing is stopping them, they can rebase off of this PR, this is a quite common workflow. This will be merged after all comments are satisfied. Pls be patient. We have a tremendous amount of PRs

Yeah, I get there's lots of traffic. I mentioned this because this PR was basically finished and it's not a "beginner workflow" to rebase off an open PR.
@jreback 
> small comments ping on green.

ping on green
thanks!