Skip to content

feat: add full_log option to suppress the diff table in equality errors - #195

Open
nanjeshramesh wants to merge 1 commit into
MrPowers:mainfrom
nanjeshramesh:full-log-param
Open

feat: add full_log option to suppress the diff table in equality errors#195
nanjeshramesh wants to merge 1 commit into
MrPowers:mainfrom
nanjeshramesh:full-log-param

Conversation

@nanjeshramesh

Copy link
Copy Markdown

PR Checklist

  • A description of the changes is added to the description of this PR.
  • If there is a related issue, make sure it is linked to this PR.
  • If you've fixed a bug or added code that should be tested, add tests!
  • If you've added or modified a feature, documentation in docs is updated

Description of changes

Closes #43.

When assert_df_equality or assert_approx_df_equality fails on a wide or long
DataFrame, the exception message includes the full row-by-row diff table.
That's usually great, but on bigger DataFrames it can get long enough to be
hard to read or to get truncated by the test runner's output.

This adds an optional full_log parameter to both functions. It defaults to
True, so nothing changes unless you opt in. Setting it to False swaps the
table for a short "DataFrames are not equal" message instead.

Threaded through both public entry points, the Chispa class wrapper, and
both raise sites in rows_comparer.py. Added tests for the default behavior
and the new short-message path on both functions, plus a line in the README
next to the other optional parameters (ignore_metadata, transforms,
underline_cells).

Ran the full test suite, ruff, and mypy in strict mode locally, all clean.

When assert_df_equality or assert_approx_df_equality fails on a wide or
long DataFrame, the exception message includes the entire row-by-row
diff table, which can get long enough that it's hard to read or gets
truncated by the test runner. This adds an optional full_log parameter
(default True, so nothing changes unless you opt in) that swaps the
table for a short message when set to False.

Threaded through both public entry points, the Chispa class wrapper,
and both raise sites in rows_comparer.py. Added tests for the default
behavior and the new short-message path on both assert_df_equality and
assert_approx_df_equality, and a line in the README next to the other
optional parameters.

No existing behavior changes, full_log defaults to True everywhere.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add parameter to enable DataFramesNotEqualError to be raised without printing the differences between the two dataframes

1 participant