home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 622342323

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/pull/4018#issuecomment-622342323 https://api.github.com/repos/pydata/xarray/issues/4018 622342323 MDEyOklzc3VlQ29tbWVudDYyMjM0MjMyMw== 1700203 2020-05-01T10:51:20Z 2020-05-01T10:51:20Z CONTRIBUTOR

Currently, the error that is raised by coerce_nc3_dtype is not covered by tests.

A test could look something like this:

```python def test_dtype_coercion_error(self): for dtype in _nc3_dtype_coercions: if dtype == "bool": continue

        # Create some data that cannot be coerced (cause it's a downcast)
        dtype = np.dtype(dtype)
        maxval = np.iinfo(dtype).max
        x = np.array([0, 1, 2, maxval], dtype=dtype)
        test_data = Dataset({"x": ("t", x, {})})

        # Make sure a roundtrip fails
        with pytest.raises(ValueError, match="could not safely cast"):
            self.roundtrip(test_data)

```

... but I'm not sure ... * whether this would be desirable to test * whether this PR should take care of this or not * where in test_backend.py I would have to put the test case such that it's invoked only for netcdf3. * I already found the NetCDF3Only class and requires_scipy decorator, but don't know which test class is responsible here ...

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  610687463
Powered by Datasette · Queries took 180.28ms · About: xarray-datasette