Skip to content

Commit

Permalink
Make the message clearer to avoid confusion about a scary and lengthy…
Browse files Browse the repository at this point in the history
… test stack (#3298)

Summary:
Pull Request resolved: #3298

We have a pretty convenient feature in Ax' `TestCase`, to deeply compare unequal objects. This can help a lot if you know how to use it, but folks mentioned to me that because the printout is lengthy, folks sometimes get scared of it and don't read it all the way through. Here's my attempt to make it friendlier : )

For illustration, printout (see how it's actually pretty useful if we look all the way through?):

{F1974874829}

Created from CodeHub with https://fburl.com/edit-in-codehub

Reviewed By: Cesar-Cardoso

Differential Revision: D68987651

fbshipit-source-id: 941b48df7fc900935d4fa564cf1430951c6c9cd6
  • Loading branch information
Lena Kashtelyan authored and facebook-github-bot committed Feb 1, 2025
1 parent c9e7de7 commit 6ae638c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ax/utils/common/testutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,9 +428,11 @@ def assertAxBaseEqual(
else first != second
):
raise self.failureException(
"Encountered unequal objects. "
"Attempting in-depth comparison; note that this recurs through the"
" attributes of the objects being compared multiple times!\n\n"
"Encountered unequal objects. This Ax utility will now attempt an "
"in-depth comparison of the objects to print out the actually "
"unequal fields within them. Note that the resulting printout is "
"a nested comparison, and you'll find the actual unequal fields at "
"the very bottom. Don't be scared of the long printout : )\n\n"
+ _build_comparison_str(
first=first, second=second, skip_db_id_check=skip_db_id_check
),
Expand Down

0 comments on commit 6ae638c

Please sign in to comment.