Commit 7228e8f
Remove mypy exclusion for test_dataarray (#10761)
* Remove mypy exclusion for xarray.tests.test_dataarray
This commit removes test_dataarray from the mypy exclusions list and fixes
all resulting type errors:
- Add type ignores for intentional test cases that verify error handling
- Add type ignore for scipy import fallback to object
- Split test_astype_attrs to handle Variable separately from DataArray/Dataset
due to different method signatures (Variable.astype doesn't have keep_attrs)
- Add type ignores for MultiIndex.get_level_values calls where names may be None
All tests continue to pass after these changes.
Co-authored-by: Claude <noreply@anthropic.com>
* Update CLAUDE.md to use noreply@anthropic.com for co-authorship
This email format is more likely to be recognized by GitHub for bot/AI
co-authorship attribution.
Co-authored-by: Claude <noreply@anthropic.com>
* Fix mypy unused-ignore errors
Use the established pattern of including unused-ignore in the type ignore
comments for cases where the ignore necessity varies by environment:
- scipy_.py: scipy import is optional, so ignore is unused when scipy is installed
- test_dataarray.py: pandas-stubs versions vary in their MultiIndex.names typing
Co-authored-by: Claude <noreply@anthropic.com>
* Clarify comment about test_astype_attrs split
The split is required for mypy type checking, not due to API differences.
Variable, DataArray, and Dataset don't share a common base class that mypy
recognizes, so when they're in the same list, mypy infers the type as
'object', which lacks the attrs and astype methods.
Co-authored-by: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 41c7990 commit 7228e8f
File tree
4 files changed
+17
-10
lines changed- xarray
- backends
- tests
4 files changed
+17
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
193 | | - | |
194 | 193 | | |
195 | 194 | | |
196 | 195 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
165 | | - | |
| 165 | + | |
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
| |||
1243 | 1243 | | |
1244 | 1244 | | |
1245 | 1245 | | |
1246 | | - | |
| 1246 | + | |
1247 | 1247 | | |
1248 | 1248 | | |
1249 | 1249 | | |
| |||
1260 | 1260 | | |
1261 | 1261 | | |
1262 | 1262 | | |
1263 | | - | |
| 1263 | + | |
1264 | 1264 | | |
1265 | 1265 | | |
1266 | 1266 | | |
| |||
1273 | 1273 | | |
1274 | 1274 | | |
1275 | 1275 | | |
1276 | | - | |
| 1276 | + | |
1277 | 1277 | | |
1278 | 1278 | | |
1279 | 1279 | | |
| |||
2206 | 2206 | | |
2207 | 2207 | | |
2208 | 2208 | | |
2209 | | - | |
| 2209 | + | |
2210 | 2210 | | |
2211 | 2211 | | |
2212 | 2212 | | |
| |||
2237 | 2237 | | |
2238 | 2238 | | |
2239 | 2239 | | |
2240 | | - | |
| 2240 | + | |
2241 | 2241 | | |
2242 | 2242 | | |
2243 | 2243 | | |
| |||
2335 | 2335 | | |
2336 | 2336 | | |
2337 | 2337 | | |
2338 | | - | |
| 2338 | + | |
| 2339 | + | |
| 2340 | + | |
| 2341 | + | |
2339 | 2342 | | |
2340 | 2343 | | |
2341 | 2344 | | |
| 2345 | + | |
| 2346 | + | |
| 2347 | + | |
| 2348 | + | |
| 2349 | + | |
2342 | 2350 | | |
2343 | 2351 | | |
2344 | 2352 | | |
| |||
0 commit comments