[
https://issues.apache.org/jira/browse/ARROW-2647?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17065959#comment-17065959
]
Joris Van den Bossche commented on ARROW-2647:
----------------------------------------------
For a failing test I am having right now, I just wrote:
{code}
def assert_table_equal(left, right, check_metadata=False):
if left.equals(right, check_metadata=check_metadata):
return
if not left.schema.equals(right.schema):
raise AssertionError(
"Schema not equal\nLeft:\n{0}\nRight:\n{1}".format(
left.schema, right.schema
)
)
if check_metadata:
if not left.schema.equals(right.schema, check_metadata=True):
if not left.schema.metadata == right.schema.metadata:
raise AssertionError(
"Metadata not equal\nLeft:\n{0}\nRight:\n{1}".format(
left.schema.metadata, right.schema.metadata
)
)
# TODO also check field metadata
for col in left.schema.names:
assert left.schema.field(col).equals(
right.schema.field(col), check_metadata=True
)
for col in left.column_names:
a_left = pa.concat_arrays(left.column(col).chunks)
a_right = pa.concat_arrays(right.column(col).chunks)
if not a_left.equals(a_right):
raise AssertionError(
"Column '{0}' not equal:\n{1}".format(col, a_left.diff(a_right))
)
raise AssertionError("Tables not equal for unknown reason")
{code}
> [C++/Python] Provide assertion helpers in the style of
> pandas.testing.assert_frame_equal
> ----------------------------------------------------------------------------------------
>
> Key: ARROW-2647
> URL: https://issues.apache.org/jira/browse/ARROW-2647
> Project: Apache Arrow
> Issue Type: New Feature
> Components: C++, Python
> Reporter: Uwe Korn
> Priority: Major
> Labels: outline_for_beginners
>
> Pandas provides helper functions for writing tests based on its data
> structures that output an explanative error message on assertion failures. In
> constrast, Arrow at the moment only supports boolean equals comparisons. We
> should add helper functions that also give a very detailed response on where
> the comparison failed.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)