Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hypothesis strategy for generating Variable objects (#8404)
* copied files defining strategies over to this branch * placed testing functions in their own directory * moved hypothesis strategies into new testing directory * begin type hinting strategies * renamed strategies for consistency with hypothesis conventions * added strategies to public API (with experimental warning) * strategies for chunking patterns * rewrote variables strategy to have same signature as Variable constructor * test variables strategy * fixed most tests * added helpers so far to API docs * add hypothesis to docs CI env * add todo about attrs * draft of new user guide page on testing * types for dataarrays strategy * draft for chained chunking example * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * only accept strategy objects * fixed failure with passing in two custom strategies that must be compatible * syntax error in example * allow sizes dict as argument to variables * copied subsequences_of strategy * coordinate_variables generates non-dimensional coords * dataarrays strategy given nothing working! * improved docstrings * datasets strategy works (given nothing) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * pass dims or data to dataarrays() strategy * importorskip hypothesis in tests * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * added warning about inefficient example generation * remove TODO about deterministic examples in docs * un-restrict names strategy * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * removed convert kwarg * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * avoid using subsequences_of * refactored into separate function for unique subset of dims * removed subsequences_of * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix draw(st.booleans()) * remove all references to chunking until chunks strategy merged upstream in dask * added example of complicated strategy for dims dict * remove superfluous utils file * removed elements strategy * removed np_arrays strategy from public API * min_ndims -> min_dims * forbid non-matching dims and data completely * simple test for data_variables strategy * passing arguments to datasets strategy * whatsnew * add attrs strategy * autogenerate attrs for all objects * attempt to make attrs strategy quicker * extend deadline * attempt to speed up attrs strategy * promote all strategies to be functions * valid_dtypes -> numeric_dtypes * changed hypothesis error type * make all strategies keyword-arg only * min_length -> min_side * correct error type * remove coords kwarg * test different types of coordinates are sometimes generated * zip dict Co-authored-by: Zac Hatfield-Dodds <[email protected]> * add dim_names kwarg to dimension_sizes strategy * return a dict from _alignable_variables * add coord_names arg to coordinate_variables strategy * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * change typing of dims arg * support dims as list to datasets strat when data not given * put coord and data var generation in optional branch to try to improve shrinking * improve simple test example * add documentation on creating duck arrays * okexcept for sparse examples * fix sparse dataarrays example * todo about building a duck array dataset * fix imports and cross-links * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * add hypothesis library to intersphinx mapping * fix many links * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fixed all local mypy errors * move numpy strategies import * reduce sizes * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix some api links in docs * remove every strategy beyond variables * variable strategy now accepts callable generating array strategies * use only readable unicode characters in names * examples * only use unicode characters that docs can deal with * docs: dataarrays -> variables * update tests for variables strategy * test values in attrs dict * duck array type examples * altered whatsnew * maybe fix mypy * fix some mypy errors * more typing changes * fix import * skip doctests in docstrings * fix link to duckarrays page * don't actually try to run cupy in docs env * missed a skip * okwarning * just remove the cupy example * ensure shape is always passed to array_strategy_fn * test using make_strategies_namespace * test catching array_strategy_fn that returns different dtype * test catching array_strategy_fn that returns different shape * generalise test of attrs strategy * remove misguided comments * save working version of test_mean * expose unique_subset_of * generalize unique_subset_of to handle iterables * type hint unique_subset_of using overloads * use iterables in test_mean example * test_mean example in docs now uses iterable of dimension_names * fix some warnings in docs build * example of passing list to unique_subset_of * fix import in docs page * try to satisfy sphinx * Minor corrections to docs * Add supported_dtypes to list of public strategies in docs * Generate number of dimensions in test_given_arbitrary_dims_list Co-authored-by: Zac Hatfield-Dodds <[email protected]> * Update minimum version of hypothesis Co-authored-by: Zac Hatfield-Dodds <[email protected]> * fix incorrect indentation in autosummary * link to docs page on testing * use warning imperative for array API non-compliant dtypes * fix bugs in sparse examples * add tag for array API standard info * move no-dependencies-on-other-values-inputs to given decorator * generate everything that can be generated * fix internal link to page on strategies * split up TypeError messages for each arg * use hypothesis.errors.InvalidArgument * generalize tests for generating specific number of dimensions * fix some typing errors * test that reduction example in docs actually works * fix typing errors * simply generation of sparse arrays in example * fix impot in docs example * correct type hints in sparse example * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Use .copy in convert_to_sparse Co-authored-by: Justus Magin <[email protected]> * Use st.builds in sparse example Co-authored-by: Justus Magin <[email protected]> * correct intersphinx link in whatsnew * rename module containing assertion functions * clarify sentence * add general ImportError if hypothesis not installed * add See Also link to strategies docs page from docstring of every strategy * typo in ImportError message * remove extra blank lines in examples * remove smallish_arrays --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Zac Hatfield-Dodds <[email protected]> Co-authored-by: Justus Magin <[email protected]>
- Loading branch information