(tmp_path: Path)
| 7475 | |
| 7476 | @requires_scipy |
| 7477 | def test_scipy_entrypoint(tmp_path: Path) -> None: |
| 7478 | entrypoint = ScipyBackendEntrypoint() |
| 7479 | ds = create_test_data() |
| 7480 | |
| 7481 | path = tmp_path / "foo" |
| 7482 | ds.to_netcdf(path, engine="scipy") |
| 7483 | _check_guess_can_open_and_open(entrypoint, path, engine="scipy", expected=ds) |
| 7484 | _check_guess_can_open_and_open(entrypoint, str(path), engine="scipy", expected=ds) |
| 7485 | with open(path, "rb") as f: |
| 7486 | _check_guess_can_open_and_open(entrypoint, f, engine="scipy", expected=ds) |
| 7487 | |
| 7488 | contents = ds.to_netcdf(engine="scipy") |
| 7489 | _check_guess_can_open_and_open(entrypoint, contents, engine="scipy", expected=ds) |
| 7490 | _check_guess_can_open_and_open( |
| 7491 | entrypoint, BytesIO(contents), engine="scipy", expected=ds |
| 7492 | ) |
| 7493 | |
| 7494 | path = tmp_path / "foo.nc.gz" |
| 7495 | with gzip.open(path, mode="wb") as f: |
| 7496 | f.write(contents) |
| 7497 | _check_guess_can_open_and_open(entrypoint, path, engine="scipy", expected=ds) |
| 7498 | _check_guess_can_open_and_open(entrypoint, str(path), engine="scipy", expected=ds) |
| 7499 | |
| 7500 | assert entrypoint.guess_can_open("something-local.nc") |
| 7501 | assert entrypoint.guess_can_open("something-local.nc.gz") |
| 7502 | assert not entrypoint.guess_can_open("not-found-and-no-extension") |
| 7503 | assert not entrypoint.guess_can_open(b"not-a-netcdf-file") |
| 7504 | # Should not claim .gz files that aren't netCDF |
| 7505 | assert not entrypoint.guess_can_open("something.zarr.gz") |
| 7506 | assert not entrypoint.guess_can_open("something.tar.gz") |
| 7507 | assert not entrypoint.guess_can_open("something.txt.gz") |
| 7508 | |
| 7509 | |
| 7510 | @requires_h5netcdf |
nothing calls this directly
no test coverage detected
searching dependent graphs…