Skip to content

TST: add tests validating primitive input_types shapes#2773

Open
Lakshmi786 wants to merge 1 commit into
alteryx:mainfrom
Lakshmi786:test/input-types-shape-validation
Open

TST: add tests validating primitive input_types shapes#2773
Lakshmi786 wants to merge 1 commit into
alteryx:mainfrom
Lakshmi786:test/input-types-shape-validation

Conversation

@Lakshmi786

Copy link
Copy Markdown

Summary

Adds four parametrised pytest tests that validate the shape contracts
for input_types across all 203 registered primitives.

Contracts tested:

  1. input_types is never empty
  2. Items are uniformly ColumnSchema (flat) or list (nested) — never mixed
  3. When nested, all sub-lists are the same length
  4. When nested, no sub-list is empty

All 812 generated test cases pass on the current codebase.

Closes #2086

Adds four parametrised tests (run against all 203 primitives) that
assert the contracts the codebase relies on for input_types:

  1. The list is never empty.
  2. Items are either all ColumnSchema (flat) or all list (nested),
     never a mix of the two.
  3. When nested, all sub-lists are the same length.
  4. When nested, no sub-list is empty.

Closes alteryx#2086
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


Lakshmi786 seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@Lakshmi786

Copy link
Copy Markdown
Author

Hi team! 👋

I am a ML/Data Science engineer working on improving open-source tooling. I noticed issue #2086 had been open for a while with no test coverage for input_types shape validation, so I went ahead and implemented it.

What this PR adds

Four parametrised pytest tests that run against all 203 registered primitives and assert the contracts the codebase relies on for input_types:

  1. The outer list is never empty
  2. Items are uniformly ColumnSchema (flat) or list (nested) — never a mix
  3. When nested, all sub-lists are the same length
  4. When nested, no sub-list is empty

All 812 generated test cases pass on the current codebase.

Happy to adjust the test style, naming, or scope based on your feedback. Let me know if you'd like me to also add these checks to the PrimitiveBase class itself as a runtime guard.

Thanks for maintaining such a great library!

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.

Add tests that confirm primitive input_types are the expected shapes

2 participants