Skip to content

Property-based testing with Hypothesis #260

@spencerahill

Description

@spencerahill

Property-based testing is a way of writing unit tests that, rather than feeding in a specific piece of test data, repeats each test over a wide range of possible viable input data. This makes the resulting test suite much more thorough and thus more likely to catch bugs and edge cases.

Xarray has implemented this (pydata/xarray#1972) using the Hypothesis library. As always, given that xarray is doing it, I think it would be good for us to also.

We could add/convert to these kind of tests gradually -- it wouldn't need to be all at once. If, once we've gotten the hang of them and can assess their value/performance hit (they do run slower than normal tests), we can decide whether to keep using/enforce/stop using them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions