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

[Feature] Allow whitespace-formatted csv in the new unit tests #9893

Closed
3 tasks done
khaledh opened this issue Apr 11, 2024 · 2 comments
Closed
3 tasks done

[Feature] Allow whitespace-formatted csv in the new unit tests #9893

khaledh opened this issue Apr 11, 2024 · 2 comments

Comments

@khaledh
Copy link

khaledh commented Apr 11, 2024

Is this your first time submitting a feature request?

  • I have read the expectations for open source contributors
  • I have searched the existing issues, and I could not find an existing issue for this feature
  • I am requesting a straightforward extension of existing dbt functionality, rather than a Big Idea better suited to a discussion

Describe the feature

The new unit tests capability allows specifying mocked inputs/expected rows using csv. It seems it's strict about whitespace in the csv data, so it's not possible to align the csv columns for readability.

For example, the following works:

unit_tests:
  - name: test_demo
    model: demo
    given:
      - input: ref('shops')
        format: csv
        rows: |
          shop_id,country_code
          1,US
          2,US
          3,CA
    expect:
      format: csv
      rows: |
        country_code,number_of_shops
        US,2
        CA,1

but the following fails:

unit_tests:
  - name: test_demo
    model: demo
    given:
      - input: ref('shops')
        format: csv
        rows: |
          shop_id,country_code
          1,      US
          2,      US
          3,      CA
    expect:
      format: csv
      rows: |
        country_code,number_of_shops
        US,          2
        CA,          1
actual differs from expected:

@@,country_code,number_of_shops
→ ,US→␣␣␣␣␣␣US ,2
→ ,CA→␣␣␣␣␣␣CA ,1

Describe alternatives you've considered

The alternative is to stick to the condensed csv format, but it hurts readability.

Who will this benefit?

Users who will rely on the new built-in unit tests.

Are you interested in contributing this feature?

No response

Anything else?

No response

@khaledh khaledh added enhancement New feature or request triage labels Apr 11, 2024
@graciegoheen
Copy link
Contributor

Hello! Thanks for the feedback. I'm going to close this issue as a dupe of this one -> #9280

If you feel anything is missing from that ticket, let me know

@graciegoheen graciegoheen closed this as not planned Won't fix, can't repro, duplicate, stale Apr 11, 2024
@graciegoheen graciegoheen removed enhancement New feature or request triage labels Apr 11, 2024
@khaledh
Copy link
Author

khaledh commented Apr 11, 2024

@graciegoheen My bad, I didn't look close enough in the existing issues. Thanks!

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

No branches or pull requests

2 participants