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

Inferred dtype property tests #856

Merged
merged 12 commits into from
Feb 14, 2024
Merged

Conversation

billylanchantin
Copy link
Contributor

Description

We've had a few issues with the inferred dtype logic (unsurprising, it's tricky!). I thought we may benefit from some property tests moving forward.

Basic Idea

I've written a generator for dtypes and a generator for series of a specific dtype. I'm currently testing roughly the following property:

dtype |> series_of_dtype |> Series.dtype |> sub_dtype_of?(dtype)

where sub_dtype_of? deals with the fact that empty lists result in the :null dtype.

First hit

I believe I've already found a bug with these tests. I've included it and the code which generated it as a demonstration.

Considerations before merging

  • More scalar types?
  • Fix bugs before merging?
  • How to deal with slow tests?

@josevalim
Copy link
Member

👍

How to deal with slow tests?

Skip them by default (I think exclude: [test: :property] works) and then always include them on CI.

@billylanchantin
Copy link
Contributor Author

Ok I think I've got the tests sorted. Remaining questions:

  • Do we want to add more scalar dtypes?
    • I think sticking with just {:s, 64} is probably fine for now.
  • Is the logic of sub_dtype_of?/2 correct?
    • It caught a real bug, so I'm inclined to think yes.

@josevalim
Copy link
Member

Is the logic of sub_dtype_of?/2 correct?

It looks so to me!

Copy link
Member

@josevalim josevalim left a comment

Choose a reason for hiding this comment

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

I am happy with the PR. Feel free to merge or ask others opinions. :)

@billylanchantin billylanchantin merged commit d73e963 into main Feb 14, 2024
3 checks passed
@billylanchantin billylanchantin deleted the bl-inferred-dtype-prop-test branch February 14, 2024 17:51
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.

2 participants