TST/CLN: parametrize coercion tests
State: closed

- [ ] progress towards #18706 
- [ ] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry

This is not yet finished but wanted to share progress in case of feedback. The main thing I'm questioning is the need to use the `` test_has_comprehensive_tests`` method in ``CoercionBase``. If we want to keep I would need to refactor, but I'm curious if others even find it necessary given that there are often just blank tests being created in subclasses to make that test pass

Labels:
name: Testing
description: pandas testing functions or related to the test suite
name: Dtype Conversions
description: Unexpected or buggy dtype conversions

Comments:
Hello @WillAyd! Thanks for updating the PR.



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

##### Comment last updated on December 12, 2017 at 15:34 Hours UTC
generic approach looks good.

no problem removing the actual has_comprehensive test. just use a fixture for the dtypes and the klasses and should have it covered (by-definition then we will test everything).
As far as the fixture goes are you still looking for something to inspect the test methods being provided? Starting down that path but want to make sure I'm not over-engineering a solution.

In simple pseudo-code, I have a fixture that looks like:

    @pytest.fixture(autouse=True, scope='class')
    def check_coverage(request):
        cls = request.cls
        # Check class metadata

With that I was planning to inspect each method and its parametrization to ensure all dtypes and klasses have been accounted for. Before it was pretty simple because there was a consistent naming pattern, but with parametrization the method naming isn't going to be as consistent. In some instances, the distinction of whether we are using a ``pd.Index`` or a ``pd.Series`` would be visible in the method name, but in some other cases a ``mark`` would determine which object to use.
i think that’s overkill

you can specify ids= if you need in the fixture to have consistent naming
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18721?src=pr&el=h1) Report
> Merging [#18721](https://codecov.io/gh/pandas-dev/pandas/pull/18721?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/96439fb13e941100080a8fb5c78b7b291a2dd2fe?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/18721/graphs/tree.svg?width=650&src=pr&token=eZ4WkYLtcO&height=150)](https://codecov.io/gh/pandas-dev/pandas/pull/18721?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #18721      +/-   ##
==========================================
+ Coverage   91.59%   91.59%   +<.01%     
==========================================
  Files         153      153              
  Lines       51364    51317      -47     
==========================================
- Hits        47046    47004      -42     
+ Misses       4318     4313       -5
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.45% <ø> (+0.01%)` | :arrow_up: |
| #single | `40.71% <ø> (-0.15%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/18721?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/18721/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/util/\_test\_decorators.py](https://codecov.io/gh/pandas-dev/pandas/pull/18721/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvX3Rlc3RfZGVjb3JhdG9ycy5weQ==) | `93.33% <0%> (-0.79%)` | :arrow_down: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/18721/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `82.01% <0%> (-0.52%)` | :arrow_down: |
| [pandas/core/indexes/category.py](https://codecov.io/gh/pandas-dev/pandas/pull/18721/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9jYXRlZ29yeS5weQ==) | `97.2% <0%> (-0.31%)` | :arrow_down: |
| [pandas/io/formats/format.py](https://codecov.io/gh/pandas-dev/pandas/pull/18721/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvZm9ybWF0LnB5) | `96.03% <0%> (-0.15%)` | :arrow_down: |
| [pandas/core/dtypes/dtypes.py](https://codecov.io/gh/pandas-dev/pandas/pull/18721/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZHR5cGVzL2R0eXBlcy5weQ==) | `95.14% <0%> (-0.14%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/18721/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.81% <0%> (-0.1%)` | :arrow_down: |
| [pandas/core/indexes/timedeltas.py](https://codecov.io/gh/pandas-dev/pandas/pull/18721/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy90aW1lZGVsdGFzLnB5) | `91.21% <0%> (-0.06%)` | :arrow_down: |
| [pandas/core/indexes/numeric.py](https://codecov.io/gh/pandas-dev/pandas/pull/18721/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9udW1lcmljLnB5) | `97.33% <0%> (-0.04%)` | :arrow_down: |
| [pandas/core/indexes/period.py](https://codecov.io/gh/pandas-dev/pandas/pull/18721/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9wZXJpb2QucHk=) | `92.9% <0%> (-0.04%)` | :arrow_down: |
| ... and [10 more](https://codecov.io/gh/pandas-dev/pandas/pull/18721/diff?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18721?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/18721?src=pr&el=footer). Last update [96439fb...7a072ac](https://codecov.io/gh/pandas-dev/pandas/pull/18721?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18721?src=pr&el=h1) Report
> Merging [#18721](https://codecov.io/gh/pandas-dev/pandas/pull/18721?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/96439fb13e941100080a8fb5c78b7b291a2dd2fe?src=pr&el=desc) will **decrease** coverage by `0.02%`.
> The diff coverage is `n/a`.

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

```diff
@@            Coverage Diff             @@
##           master   #18721      +/-   ##
==========================================
- Coverage   91.59%   91.57%   -0.03%     
==========================================
  Files         153      153              
  Lines       51364    51364              
==========================================
- Hits        47046    47035      -11     
- Misses       4318     4329      +11
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.43% <ø> (-0.01%)` | :arrow_down: |
| #single | `40.74% <ø> (-0.12%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/18721?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/18721/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/18721/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `82.34% <0%> (-0.2%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/18721/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.81% <0%> (-0.1%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18721?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/18721?src=pr&el=footer). Last update [96439fb...7a072ac](https://codecov.io/gh/pandas-dev/pandas/pull/18721?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).