Skip to content

Conversation

@VaggelisD
Copy link
Contributor

Before this PR:

  • Non-verbose:
before_vv
  • Verbose
before

After this PR

  • Non-verbose
after
  • Verbose
 after_vv

@VaggelisD VaggelisD force-pushed the vaggelisd/test_verbose_comparison branch 2 times, most recently from 45fedf6 to 75d8d9a Compare June 5, 2025 16:15
@VaggelisD VaggelisD changed the title Feat: Add verbose result comparison in tests Feat: Refactor model test output Jun 5, 2025
@VaggelisD VaggelisD force-pushed the vaggelisd/test_verbose_comparison branch from 75d8d9a to 55650d4 Compare June 5, 2025 16:24
Copy link
Contributor

@georgesittas georgesittas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this, curious to see what others have to say. Is it possible to point out the exact differences per different rows reported, similar to git diff?

Comment on lines 500 to 505
@abc.abstractmethod
def log_unit_test_results(self, result: ModelTextTestResult, test_duration: float) -> None:
"""Print the unit test results."""

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's factor this out into a UnitTestingConsole.

default_catalog: str | None = None,
concurrency: bool = False,
verbosity: Verbosity = Verbosity.DEFAULT,
rich_output: bool = True,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this option and not just default to rich output all the time?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My issue with that had to do with test_test.py, we check the payload itself in the exception (_check_successful_or_raise) instead of the output. That used to be a str but is now a tuple of str | Rich.Table so the comparison fails.

By allowing the old style we can maintain the tests as they are e.g test_row_order

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't seem like a good argument to keep it. We should instead update the tests, imo, unless there's a compelling reason to expose a non-rich formatting option.

How does this look in formats like CI/CD bot, magics, etc?

@VaggelisD
Copy link
Contributor Author

I like this, curious to see what others have to say. Is it possible to point out the exact differences per different rows reported, similar to git diff?

I gave this a shot, Panda's compare has the keep_equal option which turns the equal values into NaN but afaict NULL values are also stored as NaN so it makes the diff confusing in that regard.

Would be awesome if we can truly separate the equal values and keep the tables as diff only

@VaggelisD VaggelisD marked this pull request as draft June 5, 2025 17:32
" value ds \n"
" exp act exp act\n"
"0 None 2 None 3\n"
"AssertionError: Data mismatch\n\n"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now that you use rich check capture_console_output and strip_ansi_codes methods in test_table_diff.py so that the assertions strip the output of rich styling so that they can work in the tests. maybe if you end up using these they can be moved to some utils folder so that they can be shared

@VaggelisD VaggelisD force-pushed the vaggelisd/test_verbose_comparison branch 2 times, most recently from b822086 to acd65b1 Compare June 9, 2025 14:46
@VaggelisD VaggelisD changed the title Feat: Refactor model test output Feat: Refactor model test output [skip ci] Jun 9, 2025
@VaggelisD VaggelisD force-pushed the vaggelisd/test_verbose_comparison branch 4 times, most recently from 7653ce2 to 454437c Compare June 9, 2025 15:45
@VaggelisD VaggelisD force-pushed the vaggelisd/test_verbose_comparison branch from 454437c to 4b877d3 Compare June 9, 2025 15:48
@VaggelisD
Copy link
Contributor Author

Still trying to figure out the smaller output details so will close this PR and reopen once those are cleaner (plus comments are addressed)

@VaggelisD VaggelisD closed this Jun 9, 2025
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.

4 participants