TST/CLN: correctly skip in indexes/common; add test for duplicated
State: closed

Splitting up #21645 

* Added tests for `duplicated`
* Following https://github.com/pandas-dev/pandas/pull/21645#discussion_r202192191, turned several blank `return` statements (which falsely pass the test)  into `pytest.skip`.


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

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/21902?src=pr&el=h1) Report
> Merging [#21902](https://codecov.io/gh/pandas-dev/pandas/pull/21902?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/3bcc2bb4e275efef6d4d4d87ac1d661aa4c2bdbc?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `n/a`.

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

```diff
@@           Coverage Diff           @@
##           master   #21902   +/-   ##
=======================================
  Coverage   92.07%   92.07%           
=======================================
  Files         169      169           
  Lines       50684    50684           
=======================================
  Hits        46668    46668           
  Misses       4016     4016
```

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


------

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

@jreback All green. Any more feedback / comments?
> is this actually hit?

@jreback The if-branch you mentioned in `test_pickle_compat_construction` was not hit, therefore I removed it. Please re-review.
The travis failure is unrelated. There seems to be a problem with the 3.5 job when collecting parametrized tests, in that the order is not stable, which yields a failure due to different tests

```
==================================== ERRORS ====================================
_____________________________ ERROR collecting gw1 _____________________________
Different tests were collected between gw0 and gw1. The difference is:

[...]

 pandas/tests/frame/test_apply.py::TestDataFrameAggregate::()::test_agg_cython_table[axis 0-df0-sum-expected0]
-pandas/tests/frame/test_apply.py::TestDataFrameAggregate::()::test_agg_cython_table[axis 0-df1-func1-expected1]
-pandas/tests/frame/test_apply.py::TestDataFrameAggregate::()::test_agg_cython_table[axis 0-df2-sum-expected2]
+pandas/tests/frame/test_apply.py::TestDataFrameAggregate::()::test_agg_cython_table[axis 0-df1-sum-expected1]
+pandas/tests/frame/test_apply.py::TestDataFrameAggregate::()::test_agg_cython_table[axis 0-df2-func2-expected2]
 pandas/tests/frame/test_apply.py::TestDataFrameAggregate::()::test_agg_cython_table[axis 0-df3-max-expected3]
 pandas/tests/frame/test_apply.py::TestDataFrameAggregate::()::test_agg_cython_table[axis 0-df4-amax-expected4]
 pandas/tests/frame/test_apply.py::TestDataFrameAggregate::()::test_agg_cython_table[axis 0-df5-func5-expected5]

[...]
```
@jreback ping. Should be ready to go - travis failure is unrelated.
@h-vetinari actually no, your PR is causing the fail. you have non-determinism in the test generation. usually this is because the ordering of the fixtures / parameters is based on a dictionary.
@jreback 
> actually no, your PR is causing the fail

I honestly can't see how this would be the case. I only change tests (no fixtures or anything) in
- `pandas/tests/indexes/common.py`
- `pandas/tests/indexes/test_category.py`
- `pandas/tests/indexes/test_range.py`

and the collection errors are in `pandas/tests/frame/test_apply.test_agg_cython_table`.

The parametrization of that test is
```
    @pytest.mark.parametrize("df, func, expected", chain(
        _get_cython_table_params(
            DataFrame(), [
                ('sum', Series()),
                ('max', Series()),
                ('min', Series()),
                ('all', Series(dtype=bool)),
                ('any', Series(dtype=bool)),
                ('mean', Series()),
                ('prod', Series()),
                ('std', Series()),
                ('var', Series()),
                ('median', Series()),
            ]),
        _get_cython_table_params(
            DataFrame([[np.nan, 1], [1, 2]]), [
                ('sum', Series([1., 3])),
                ('max', Series([1., 2])),
                ('min', Series([1., 1])),
                ('all', Series([True, True])),
                ('any', Series([True, True])),
                ('mean', Series([1, 1.5])),
                ('prod', Series([1., 2])),
                ('std', Series([np.nan, 0.707107])),
                ('var', Series([np.nan, 0.5])),
                ('median', Series([1, 1.5])),
            ]),
    ))
```
rebased again, let's see if it helps
@jreback all green
Btw, that issue with the test order is related to #22156, #22157
thanks @h-vetinari