Commit 55b1ac0
tests for arrays with units (#3238)
* create the empty test file
* add tests for data array aggregation functions
* include pint in the ci
* ignore missing type annotations for pint
* really skip the tests if pint is not available
* remove the reason from the importorskip call
* test that the dataarray constructor does not strip the unit
* convert every unit stripped warning to an error
* work around pint not implementing np.allclose yet
* remove the now unnecessary filterwarnings decorator
* xfail all tests that depend on pint having a __array_function__
* treat nans as equal
* implement tests for simple arithmetic operations
* use param's id argument to assign readable names
* add tests for sel() and isel()
* add more readable names for the unary arithmetics
* xfail every test that is not yet xfailing
These don't pass because the constructor raises a unit stripped
warning - fixed in pint#764.
* only xfail if pint is not the current development version
This is test is not really reliable, but sufficient for now.
* always use lists instead of tuples for indexing
* add tests for loc and squeeze
* black
* add names and xfail marks to the parameters
* add tests for interp and interp_like
* implement tests for reindex
* remove the xfail marks where it is not clear yet that pint is to blame
* add tests for reindex_like
* don't pass the new DataArray to a kwarg
* xfail if not on pint dev
* refactor the tests
* add tests for univariate and bivariate ufuncs
* black
* xfail aggregation only if pint does not implement __array_function__ yet
* remove the global filterwarnings mark
apparently, this caused the tests to change behavior, resulting in
different errors, or causing tests to pass that should actually fail.
* add a test case for the repr
* create a pytest mark that explicitly requires pint's __array_function__
* also check the string representation in addition to the repr
* add helpers for creating method tests
* check that simple aggregation methods work
* use format() instead of format strings
* make sure the repr of method calls is different from functions
* merge the two aggregation tests
* explicitly check whether pint supports __array_function__
relying on versions is somewhat fragile.
* provide a fallback for the new base quantity
* check that no warning is raised for both with and without coords
* also check that the repr works both with and without coords
* wrap all aggregation function calls
* xfail every call that fails because of something outside xarray
* xfail tests related to dimension coordinates and indexes
* use the dimensions from the original array
* allow passing arguments to the method on call
* add tests for comparisons
* add tests for detecting, filling and dropping missing values
* mark the missing value tests as requiring pint to support duck arrays
* add tests for isin, where and interpolate_na
* reformat unit ids and add a test parameter for compatible units
* remove an unnecessary xfail
* add tests for the top-level replication functions (*_like)
* check for whatever pint does with *_like functions
* add tests for combine_first
* xfail the bivariate ufunc tests
* xfail the call to np.median
* move the top-level function tests out of the DataArray namespace class
* add cumsum and cumprod to the list of aggregation functions
* add tests for the numpy methods
* check for equal units directly after checking the magnitude
* add tests for content manipulation methods
* add tests for comparing DataArrays (equals, indentical)
* add a test for broadcast_equals
* refactor the comparison operation tests
* rewrite the strip, attach and assert_equal functions and add extract
* preserve multiindex in strip and attach
* attach the unit from element "data" as fallback
* fix some small typos
* compare QuantityScalar and QuantitySequence based on their values
* make the isel test more robust
* add tests for reshaping and reordering
* unify the structure of the tests
* mark the remaining tests as requiring a recent pint version, too
* explicitly handle quantities as parameters
* change the repr of the function / method wrappers
* check whether __init__ and repr / str handle units in data and coords
* generalize array_attach_units
* move the redefinition of DimensionalityError
* identify quantities using isinstance
* typo
* skip tests with a pint version without __array_function__
* compare DataArrays where possible
* mark only the compatible unit as xfailing
* preserve the name of data arrays
* also attach units to x_mm
* Test in more CI environments; documentation
* What's New
* remove a stale function
* use Quantity directly for instance tests
* explicitly set roll_coords to silence a deprecation warning
* skip the whole module if pint does not implement __array_function__
the advantage is that now forgetting to decorate a test case is not possible.
* allow to attach units using the mapping from extract_units
* add tests for computation methods
resampling fails until I figure out how to use it with non-datetime coords.
* add tests for grouped operations
* add a test for rolling_exp
* add a todo note for the module level skip on __array_function__
* add a test for dot
* use attach_units instead of manually attaching
* modify the resample test to actually work
* add a test for to_unstacked_dataset
* update whats-new.rst and installing.rst
* reformat the whats-new.rst entry
* What's New1 parent 1f81338 commit 55b1ac0
File tree
9 files changed
+1667
-2
lines changed- ci/requirements
- doc
- xarray/tests
9 files changed
+1667
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
69 | 78 | | |
70 | 79 | | |
71 | 80 | | |
| |||
85 | 94 | | |
86 | 95 | | |
87 | 96 | | |
88 | | - | |
| 97 | + | |
89 | 98 | | |
90 | 99 | | |
91 | 100 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
21 | 34 | | |
22 | 35 | | |
23 | 36 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| 76 | + | |
| 77 | + | |
76 | 78 | | |
77 | 79 | | |
78 | 80 | | |
| |||
0 commit comments