Commit 467dda7
chore: indexing test cleanup (#4001)
* docs: design spec for indexing test cleanup
Plan to consolidate and speed up tests/test_indexing.py: shrink oversized
arrays (>=3 chunks/axis, partial edge), replace np.random selection loops
with hand-picked parametrized cases via the Expect/ExpectFail dataclasses,
one-behavior-per-test isolation, and docstrings throughout. Includes a
prerequisite step deduplicating the two divergent Expect dataclass pairs
(tests/conftest.py vs tests/test_codecs/conftest.py) onto one canonical pair.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* docs: implementation plan for indexing test cleanup
Task-by-task plan: Expect dataclass dedup (Part 0) then per-family rewrites
of tests/test_indexing.py to parametrized Expect/ExpectFail cases on smaller
arrays (Part 1), with final verification and speed measurement (Part 2).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* test: make canonical Expect/ExpectFail frozen
Prepares for deduplicating the second Expect pair in test_codecs/conftest.py.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* test: migrate test_chunk_grids to canonical Expect/ExpectFail
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* test: migrate test_cast_value to canonical Expect/ExpectFail
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* test: migrate test_scale_offset to canonical Expect/ExpectFail
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* test: delete duplicate Expect dataclasses in test_codecs/conftest.py
All consumers now use the canonical Expect/ExpectFail from tests/conftest.py.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* test: rewrite orthogonal 1d bool indexing as parametrized cases
Smaller array (30 elems, chunks of 7), hand-picked deterministic masks
replacing np.random sparsity sweep, error paths split into their own test.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* docs: add Task 0.6 (optional ExpectFail.msg + raises helper)
Structural fix for the msg="" footgun discovered during Task 1.1: msg becomes
optional and regex-matched via a case.raises() helper, with an escape flag.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* test: make ExpectFail.msg optional with a raises() helper
msg defaults to None (assert exception type only) and is treated as a regex,
with an escape flag for literal messages. Removes the msg="" footgun that the
repo's filterwarnings=["error"] config turned into a failure.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* test: clearer single-true mask idiom in orthogonal 1d exemplar
np.arange(30) == 7 reads better than np.eye(1, 30, 7)[0]; matters because the
other indexing families copy this exemplar.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* test: rewrite orthogonal 1d int indexing as parametrized cases
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* test: rewrite orthogonal 2d indexing as parametrized cases
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* test: rewrite orthogonal 3d indexing as parametrized cases
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* test: rewrite set-orthogonal indexing family as parametrized cases
Reuses the get-orthogonal case tables; deletes the per-dimensionality set
helpers.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* test: rewrite basic 1d/2d selection families as parametrized cases
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* test: restore basic-indexing integer-list rejection coverage
The basic-selection rewrite dropped two assertions that get_basic_selection
rejects integer-list selections (1D direct, 2D nested in a tuple); restore
them as dedicated get-only tests, since z[...] falls back to fancy indexing.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* test: rewrite coordinate selection family as parametrized cases
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* test: rewrite block selection family as parametrized cases
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* test: rewrite mask selection family as parametrized cases
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* test: shrink arrays in selection_out and numpy-equivalence tests
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* test: add behavior docstrings to remaining indexing tests
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* test: drop redundant pytest.mark.asyncio decorators
asyncio_mode = "auto" already collects async test functions; the explicit
marks were no-ops.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* docs: add changelog fragment for indexing test cleanup
Rename XXXX.misc.md to the PR number when the PR is opened.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* test: explain msg=None on the basic-1d string bad case
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* docs: remove LLM plans
* docs: rename changelog
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 6827a61 commit 467dda7
8 files changed
Lines changed: 1074 additions & 1022 deletions
File tree
- changes
- tests
- test_codecs
- test_metadata
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
| 54 | + | |
53 | 55 | | |
54 | 56 | | |
55 | 57 | | |
| |||
64 | 66 | | |
65 | 67 | | |
66 | 68 | | |
67 | | - | |
| 69 | + | |
68 | 70 | | |
69 | 71 | | |
70 | 72 | | |
| |||
73 | 75 | | |
74 | 76 | | |
75 | 77 | | |
76 | | - | |
| 78 | + | |
77 | 79 | | |
78 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
79 | 87 | | |
80 | 88 | | |
81 | 89 | | |
82 | 90 | | |
83 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
84 | 99 | | |
85 | 100 | | |
86 | 101 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | 1 | | |
3 | 2 | | |
4 | 3 | | |
5 | 4 | | |
6 | 5 | | |
7 | | - | |
| 6 | + | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
| |||
131 | 130 | | |
132 | 131 | | |
133 | 132 | | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
140 | 158 | | |
141 | | - | |
| 159 | + | |
142 | 160 | | |
| 161 | + | |
| 162 | + | |
143 | 163 | | |
144 | | - | |
| 164 | + | |
145 | 165 | | |
146 | 166 | | |
147 | | - | |
| 167 | + | |
148 | 168 | | |
| 169 | + | |
| 170 | + | |
149 | 171 | | |
150 | | - | |
| 172 | + | |
151 | 173 | | |
152 | 174 | | |
153 | | - | |
| 175 | + | |
154 | 176 | | |
| 177 | + | |
| 178 | + | |
155 | 179 | | |
156 | | - | |
| 180 | + | |
157 | 181 | | |
158 | 182 | | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
| 183 | + | |
170 | 184 | | |
171 | | - | |
| 185 | + | |
172 | 186 | | |
173 | 187 | | |
174 | | - | |
| 188 | + | |
175 | 189 | | |
176 | 190 | | |
177 | 191 | | |
178 | 192 | | |
179 | 193 | | |
180 | 194 | | |
181 | | - | |
| 195 | + | |
182 | 196 | | |
| 197 | + | |
| 198 | + | |
183 | 199 | | |
184 | | - | |
185 | 200 | | |
186 | 201 | | |
187 | 202 | | |
188 | | - | |
| 203 | + | |
189 | 204 | | |
| 205 | + | |
| 206 | + | |
190 | 207 | | |
191 | | - | |
192 | 208 | | |
193 | | - | |
194 | | - | |
195 | | - | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
196 | 216 | | |
197 | | - | |
| 217 | + | |
198 | 218 | | |
| 219 | + | |
| 220 | + | |
199 | 221 | | |
200 | | - | |
| 222 | + | |
201 | 223 | | |
202 | 224 | | |
203 | | - | |
| 225 | + | |
204 | 226 | | |
205 | | - | |
| 227 | + | |
206 | 228 | | |
207 | 229 | | |
208 | | - | |
| 230 | + | |
209 | 231 | | |
210 | 232 | | |
211 | 233 | | |
212 | 234 | | |
213 | 235 | | |
214 | 236 | | |
215 | 237 | | |
216 | | - | |
| 238 | + | |
217 | 239 | | |
218 | | - | |
| 240 | + | |
219 | 241 | | |
220 | | - | |
| 242 | + | |
221 | 243 | | |
222 | | - | |
| 244 | + | |
223 | 245 | | |
224 | 246 | | |
225 | 247 | | |
| |||
230 | 252 | | |
231 | 253 | | |
232 | 254 | | |
233 | | - | |
| 255 | + | |
This file was deleted.
0 commit comments