You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note [left] and [right] output the same, so this help message isn't helpful.
Problem description
You can't see from the description where the differences in the CategoricalIndexes are. The reason is that Categorical return "category" for str(c1) and to see details, you need repr(c1).
Expected Output
The solution could be in the function util.testing.py::raise_assert_detail to replace
msg = """{obj} are different
{message}
[left]: {left}
[right]: {right}""".format(obj=obj, message=message, left=left, right=right)
with the repr-formattes strings:
msg = """{obj} are different
{message}
[left]: {left!r}
[right]: {right!r}""".format(obj=obj, message=message, left=left, right=right)
Note the (!r). This will give the full repr output which you'll almost always want anyway.
Alternatively, the decision to let str(c1) output "category" could be changed. That would be a breaking change, though, and would require proper deprecation warning.
I could submit a PR if the solution with !r format option is acceptable.
The text was updated successfully, but these errors were encountered:
topper-123
changed the title
ENH: assert_* has very superficial description of CategorialIndex are different
ENH: assert_* has very superficial description if CategorialIndex are different
Oct 31, 2017
Alternatively, the decision to let str(c1) output "category" could be changed. That would be a breaking change, though, and would require proper deprecation warning.
In the CategoricalDtype refactor, we decided to have str(categoricaldtype) be 'category', and reprbe the full one.
Code Sample, a copy-pastable example if possible
Note
[left]
and[right]
output the same, so this help message isn't helpful.Problem description
You can't see from the description where the differences in the CategoricalIndexes are. The reason is that Categorical return
"category"
forstr(c1)
and to see details, you needrepr(c1)
.Expected Output
The solution could be in the function
util.testing.py::raise_assert_detail
to replacewith the repr-formattes strings:
Note the (
!r
). This will give the full repr output which you'll almost always want anyway.Alternatively, the decision to let
str(c1)
output"category"
could be changed. That would be a breaking change, though, and would require proper deprecation warning.I could submit a PR if the solution with
!r
format option is acceptable.The text was updated successfully, but these errors were encountered: