Skip to content
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

Improve datafusion-cli print format tests #8896

Merged
merged 1 commit into from
Jan 19, 2024

Conversation

alamb
Copy link
Contributor

@alamb alamb commented Jan 17, 2024

Draft as it build on #8895

Which issue does this PR close?

Related to #8702

Follow on to #8895

Rationale for this change

While working on #8895 I found the tests somewhat hard to follow and it was hard for me to understand if there were existing tests that covered I was changing.

It was also hard top understand the coverage in general given how the tests were structured

What changes are included in this PR?

  1. Rework tests in print_format to be more explict
  2. Add additional coverage for TSV and empty result printing

Are these changes tested?

This PR is all tests (no code changes)

Are there any user-facing changes?

No

PrintFormat::Automatic,
] {
// no output for empty batches, even with header set
PrintBatchesTest::new()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this style of test is clearer what is expected and what is covered

PrintBatchesTest::new()
.with_format(PrintFormat::Table)
.with_batches(split_batch(three_column_batch()))
.with_header(WithHeader::Ignored)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now there is additional coverage for formats that ignore the with_header flag

@alamb alamb marked this pull request as ready for review January 18, 2024 13:58
Copy link
Contributor

@comphead comphead left a comment

Choose a reason for hiding this comment

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

lgtm thanks @alamb

@Dandandan Dandandan merged commit 3a9e23d into apache:main Jan 19, 2024
22 checks passed
@alamb alamb deleted the alamb/rework_format_tests branch January 19, 2024 20:07
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.

3 participants