Commit d91d78c
committed
Address Copilot review feedback on #1653
- Mirror to_geotiff's cog=True + file-like rejection verbatim (same
error string), so callers see identical messages from either entry
point. Previously write_geotiff_gpu raised a different message that
added "...on the GPU writer..." and dropped the BytesIO hint.
- Add a TypeError gate for non-str, non-file-like path arguments, so
passing e.g. an int falls through to a clear TypeError instead of an
os.path / unicode error deep in the writer. Mirrors to_geotiff's
existing TypeError verbatim.
- Harden the BytesIO + write_geotiff_gpu tests with the repo's standard
_gpu_available() helper (cupy.cuda.is_available() + ImportError
guard) instead of pytest.importorskip('cupy'), so CI hosts where
CuPy imports but CUDA is unavailable skip cleanly rather than
hard-failing in cupy.asarray().
- Add two new regression tests: one pinning byte-for-byte parity of the
cog/file-like error message between the two writers, and one pinning
the new TypeError on invalid path types.
Skip: the low-confidence type annotation suggestion (path:
str|os.PathLike|SupportsWrite[bytes]). The other path-accepting
functions in this module (to_geotiff, write_vrt, etc.) deliberately
leave path untyped; adding a precise union here would diverge from the
local convention for marginal benefit.
All 17 tests in test_bytesio_source.py pass.1 parent 1ec50c7 commit d91d78c
2 files changed
Lines changed: 85 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2841 | 2841 | | |
2842 | 2842 | | |
2843 | 2843 | | |
2844 | | - | |
| 2844 | + | |
| 2845 | + | |
2845 | 2846 | | |
2846 | | - | |
2847 | | - | |
| 2847 | + | |
| 2848 | + | |
2848 | 2849 | | |
2849 | 2850 | | |
2850 | 2851 | | |
2851 | | - | |
2852 | | - | |
2853 | | - | |
2854 | | - | |
| 2852 | + | |
| 2853 | + | |
| 2854 | + | |
| 2855 | + | |
| 2856 | + | |
| 2857 | + | |
| 2858 | + | |
| 2859 | + | |
| 2860 | + | |
2855 | 2861 | | |
2856 | 2862 | | |
2857 | 2863 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
20 | 41 | | |
21 | 42 | | |
22 | 43 | | |
| |||
281 | 302 | | |
282 | 303 | | |
283 | 304 | | |
| 305 | + | |
284 | 306 | | |
285 | | - | |
| 307 | + | |
286 | 308 | | |
287 | 309 | | |
288 | 310 | | |
| |||
295 | 317 | | |
296 | 318 | | |
297 | 319 | | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
298 | 368 | | |
299 | | - | |
| 369 | + | |
300 | 370 | | |
301 | 371 | | |
302 | 372 | | |
| |||
0 commit comments