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

ENH: improve output for testing.assert_*_equal with Categoricals #18069

Merged
merged 1 commit into from Nov 2, 2017

Conversation

Projects
None yet
4 participants
@topper-123
Contributor

topper-123 commented Nov 1, 2017

  • [x ] closes #18056
  • tests added / passed
  • [ x] passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • [x ] whatsnew entry

The new CategoricalDtype made the output from failing tests uninformative, see #18056.

The error message is now:

>>> c1 = pd.CategoricalIndex(['a', 'b'])
>>> c2 = pd.CategoricalIndex(['c', 'd'])
>>> s1 = pd.Series([1,2], index=c1)
>>> s2 = pd.Series([1,2], index=c2)
>>> pd.testing.assert_series_equal(s1, s2)
AssertionError: Series.index are different

Attribute "dtype" are different
[left]:  CategoricalDtype(categories=['a', 'b'], ordered=False)
[right]: CategoricalDtype(categories=['c', 'd'], ordered=False)

Which is much better.

Show outdated Hide outdated pandas/util/testing.py Outdated
Show outdated Hide outdated pandas/util/testing.py Outdated
@codecov

This comment has been minimized.

Show comment
Hide comment
@codecov

codecov bot Nov 2, 2017

Codecov Report

Merging #18069 into master will increase coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #18069      +/-   ##
==========================================
+ Coverage   91.25%   91.26%   +<.01%     
==========================================
  Files         163      163              
  Lines       50120    50120              
==========================================
+ Hits        45737    45740       +3     
+ Misses       4383     4380       -3
Flag Coverage Δ
#multiple 89.07% <ø> (+0.02%) ⬆️
#single 40.32% <ø> (-0.06%) ⬇️
Impacted Files Coverage Δ
pandas/util/testing.py 100% <ø> (ø) ⬆️
pandas/io/gbq.py 25% <0%> (-58.34%) ⬇️
pandas/core/frame.py 97.75% <0%> (-0.1%) ⬇️
pandas/plotting/_converter.py 65.2% <0%> (+1.81%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 15fa4bd...fde514e. Read the comment docs.

codecov bot commented Nov 2, 2017

Codecov Report

Merging #18069 into master will increase coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #18069      +/-   ##
==========================================
+ Coverage   91.25%   91.26%   +<.01%     
==========================================
  Files         163      163              
  Lines       50120    50120              
==========================================
+ Hits        45737    45740       +3     
+ Misses       4383     4380       -3
Flag Coverage Δ
#multiple 89.07% <ø> (+0.02%) ⬆️
#single 40.32% <ø> (-0.06%) ⬇️
Impacted Files Coverage Δ
pandas/util/testing.py 100% <ø> (ø) ⬆️
pandas/io/gbq.py 25% <0%> (-58.34%) ⬇️
pandas/core/frame.py 97.75% <0%> (-0.1%) ⬇️
pandas/plotting/_converter.py 65.2% <0%> (+1.81%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 15fa4bd...fde514e. Read the comment docs.

@topper-123

This comment has been minimized.

Show comment
Hide comment
@topper-123

topper-123 Nov 2, 2017

Contributor

Alright, I've adjusted according to comments from @jschendel.

Contributor

topper-123 commented Nov 2, 2017

Alright, I've adjusted according to comments from @jschendel.

@jreback jreback added this to the 0.21.1 milestone Nov 2, 2017

@jreback jreback merged commit bb4fa65 into pandas-dev:master Nov 2, 2017

2 of 3 checks passed

continuous-integration/appveyor/pr AppVeyor build failed
Details
ci/circleci Your tests passed on CircleCI!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@jreback

This comment has been minimized.

Show comment
Hide comment
@jreback

jreback Nov 2, 2017

Contributor

thanks @topper-123

Contributor

jreback commented Nov 2, 2017

thanks @topper-123

kchomski-reef pushed a commit to reef-technologies/pandas that referenced this pull request Nov 3, 2017

1kastner added a commit to 1kastner/pandas that referenced this pull request Nov 5, 2017

@topper-123 topper-123 deleted the topper-123:categorical_repr_in_testing branch Nov 6, 2017

No-Stream added a commit to No-Stream/pandas that referenced this pull request Nov 28, 2017

TomAugspurger added a commit to TomAugspurger/pandas that referenced this pull request Dec 8, 2017

TomAugspurger added a commit that referenced this pull request Dec 11, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment