From 133befd5002388ff85fdfb8f302073f95c8f3d69 Mon Sep 17 00:00:00 2001 From: Stephan Hoyer Date: Wed, 26 Jun 2019 23:35:39 -0700 Subject: [PATCH] fix the correct test --- xarray/tests/test_backends.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xarray/tests/test_backends.py b/xarray/tests/test_backends.py index f4e031de427..94e30d054ff 100644 --- a/xarray/tests/test_backends.py +++ b/xarray/tests/test_backends.py @@ -775,9 +775,7 @@ def test_encoding_kwarg(self): ds = Dataset({'x': ('y', np.arange(10.0))}) kwargs = dict(encoding={'x': {'dtype': 'f4'}}) with self.roundtrip(ds, save_kwargs=kwargs) as actual: - encoded_dtype = actual.x.encoding['dtype'] - # On OS X, dtype sometimes switches endianness for unclear reasons - assert str(encoded_dtype)[-2:] == 'f4' + assert actual.x.encoding['dtype'] == 'f4' assert ds.x.encoding == {} kwargs = dict(encoding={'x': {'foo': 'bar'}}) @@ -869,7 +867,9 @@ def test_encoding_same_dtype(self): ds = Dataset({'x': ('y', np.arange(10.0, dtype='f4'))}) kwargs = dict(encoding={'x': {'dtype': 'f4'}}) with self.roundtrip(ds, save_kwargs=kwargs) as actual: - assert actual.x.encoding['dtype'] == 'f4' + encoded_dtype = actual.x.encoding['dtype'] + # On OS X, dtype sometimes switches endianness for unclear reasons + assert encoded_dtype.kind == 'f' and encoded_dtype.itemsize == 4 assert ds.x.encoding == {} def test_append_write(self):