Closed sneakers-the-rat closed 1 month ago
This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.
Changes Missing Coverage | Covered Lines | Changed/Added Lines | % | ||
---|---|---|---|---|---|
src/numpydantic/interface/numpy.py | 7 | 8 | 87.5% | ||
src/numpydantic/serialization.py | 1 | 2 | 50.0% | ||
src/numpydantic/testing/interfaces.py | 132 | 134 | 98.51% | ||
<!-- | Total: | 313 | 317 | 98.74% | --> |
Files with Coverage Reduction | New Missed Lines | % | ||
---|---|---|---|---|
src/numpydantic/interface/zarr.py | 1 | 99.03% | ||
src/numpydantic/interface/interface.py | 3 | 98.56% | ||
src/numpydantic/interface/video.py | 5 | 96.24% | ||
<!-- | Total: | 9 | --> |
Totals | |
---|---|
Change from base Build 11063861484: | -0.4% |
Covered Lines: | 1491 |
Relevant Lines: | 1516 |
Currently
we have fixtures for specifying a number of test cases for dtypes and shapes, and then each interface validates against those test cases.
To make that work, we..
ValidationCase
model that takes an annotation and a specification for an array to test against it.ValidationCase
model can generates a model with an annotation that matches the spec in the validation caseThe shape/dtype cases look something like this:
The numpy interface tests are like this
Problem
this is proving to be a little bit brittle, and we don't test against, eg, the product of the dtype and shape cases even though we should.
we also want to test behaviors that should be true for all generators, all dtypes, and all shapes, but currently we can only run those tests against a fixed model and array pair for each interface.
we also want to make it possible for people to develop their own interfaces, and so it would be nice if we could facilitate that by providing structure for testing them and a set of tests that need to pass in order for an interface to be added to the package. (or not if they don't want to idrc)
So this PR...
InterfaceTestHelper
that provides classmethods for generating an array from aValidationCase
and for validating the array against itnumpydantic.testing
module that containsproduct
iteratorsValidationCase
to take anInterfaceTestHelper
which generalizes what is currently repeated for each of the interfaces with a lot of boilerplate.merge
method to ValidationCase to allow multiple partial validation cases to be combined.Also