-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Refactor: Update replace_with_order_preserving_variants
tests to use insta snapshots for easier updates
#17962
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…d testing Converted all tests in replace_with_order_preserving_variants.rs from macro-based assertions to snapshot-based testing using the insta crate. Key changes: - Replaced assert_optimized_in_all_boundedness_situations! and related macros with ReplaceTest helper struct - Used allow_duplicates! and assert_snapshot! for cleaner test assertions - Match order follows original test parameter ordering: (true, _), (false, false), (false, true) - All snapshots match the original expected plans from the macros - Removed unused imports and macros 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
…er_preserving_variants tests Replace boolean test parameters with more descriptive enums: - Add `Boundedness` enum with `Unbounded` and `Bounded` variants - Add `SortPreference` enum with `PreserveOrder` and `MaximizeParallelism` variants - Update `ReplaceTest` struct to use these enums instead of bool fields - Rename methods from `with_source_unbounded`/`with_prefer_existing_sort` to `with_boundedness`/`with_sort_preference` - Update all test functions to use enum parameters instead of bool - Update all match patterns to use enum variants This makes the tests more self-documenting and easier to understand, as the enum variant names clearly indicate what behavior is being tested. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
||
allow_duplicates! { | ||
match (boundedness, sort_pref) { | ||
(Boundedness::Bounded, SortPreference::MaximizeParallelism) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i changed it from bools because otherwise it'd be hard to understand what does e.g. true, false
mean
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes it is much better
Replace all `if boundedness == Boundedness::Unbounded` checks with cleaner match expressions. This improves code readability and makes the pattern matching more explicit and idiomatic. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @blaginin -- this looks like a very nice improvement to me!
async fn test_replace_multiple_input_repartition_1( | ||
#[values(false, true)] source_unbounded: bool, | ||
#[values(false, true)] prefer_existing_sort: bool, | ||
#[values(Boundedness::Unbounded, Boundedness::Bounded)] boundedness: Boundedness, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is so much easier to read!
|
||
allow_duplicates! { | ||
match (boundedness, sort_pref) { | ||
(Boundedness::Bounded, SortPreference::MaximizeParallelism) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes it is much better
Which issue does this PR close?
core
tests toinsta
#15791