Skip to content

Commit

Permalink
Test source encoding present
Browse files Browse the repository at this point in the history
  • Loading branch information
TomNicholas committed Dec 21, 2018
1 parent bcfd759 commit dfc55b1
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions xarray/tests/test_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -3356,3 +3356,14 @@ def test_no_warning_from_dask_effective_get():
ds = Dataset()
ds.to_netcdf(tmpfile)
assert len(record) == 0


@requires_scipy_or_netCDF4
def test_source_encoding_always_present():
# Test for GH issue #2550.
rnddata = np.random.randn(10)
original = Dataset({'foo': ('x', rnddata)})
with create_tmp_file() as tmp:
original.to_netcdf(tmp)
with open_dataset(tmp) as ds:
assert ds.encoding['source'] == tmp

0 comments on commit dfc55b1

Please sign in to comment.