Closed
Description
=================================== FAILURES ===================================
____________________ TestVariable.test_index_0d_not_a_time _____________________
self = <xarray.tests.test_variable.TestVariable object at 0x7f0dd7b6bda0>
def test_index_0d_not_a_time(self):
d = np.datetime64('NaT', 'ns')
x = self.cls(['x'], [d])
> self._assertIndexedLikeNDArray(x, d)
xarray/tests/test_variable.py:197:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <xarray.tests.test_variable.TestVariable object at 0x7f0dd7b6bda0>
variable = <xarray.Variable (x: 1)>
array(['NaT'], dtype='datetime64[ns]')
expected_value0 = numpy.datetime64('NaT'), expected_dtype = None
def _assertIndexedLikeNDArray(self, variable, expected_value0,
expected_dtype=None):
"""Given a 1-dimensional variable, verify that the variable is indexed
like a numpy.ndarray.
"""
assert variable[0].shape == ()
assert variable[0].ndim == 0
assert variable[0].size == 1
# test identity
assert variable.equals(variable.copy())
assert variable.identical(variable.copy())
# check value is equal for both ndarray and Variable
with warnings.catch_warnings():
warnings.filterwarnings('ignore', "In the future, 'NAT == x'")
> assert variable.values[0] == expected_value0
E AssertionError: assert numpy.datetime64('NaT') == numpy.datetime64('NaT')
E -numpy.datetime64('NaT')
E +numpy.datetime64('NaT')
xarray/tests/test_variable.py:143: AssertionError
________________ TestVariableWithDask.test_index_0d_not_a_time _________________
self = <xarray.tests.test_variable.TestVariableWithDask object at 0x7f0e00bc5978>
def test_index_0d_not_a_time(self):
d = np.datetime64('NaT', 'ns')
x = self.cls(['x'], [d])
> self._assertIndexedLikeNDArray(x, d)
xarray/tests/test_variable.py:197:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <xarray.tests.test_variable.TestVariableWithDask object at 0x7f0e00bc5978>
variable = <xarray.Variable (x: 1)>
dask.array<shape=(1,), dtype=datetime64[ns], chunksize=(1,)>
expected_value0 = numpy.datetime64('NaT'), expected_dtype = None
def _assertIndexedLikeNDArray(self, variable, expected_value0,
expected_dtype=None):
"""Given a 1-dimensional variable, verify that the variable is indexed
like a numpy.ndarray.
"""
assert variable[0].shape == ()
assert variable[0].ndim == 0
assert variable[0].size == 1
# test identity
assert variable.equals(variable.copy())
assert variable.identical(variable.copy())
# check value is equal for both ndarray and Variable
with warnings.catch_warnings():
warnings.filterwarnings('ignore', "In the future, 'NAT == x'")
> assert variable.values[0] == expected_value0
E AssertionError: assert numpy.datetime64('NaT') == numpy.datetime64('NaT')
E -numpy.datetime64('NaT')
E +numpy.datetime64('NaT')
xarray/tests/test_variable.py:143: AssertionError
__________________ TestIndexVariable.test_index_0d_not_a_time __________________
self = <xarray.tests.test_variable.TestIndexVariable object at 0x7f0e01063390>
def test_index_0d_not_a_time(self):
d = np.datetime64('NaT', 'ns')
x = self.cls(['x'], [d])
> self._assertIndexedLikeNDArray(x, d)
xarray/tests/test_variable.py:197:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <xarray.tests.test_variable.TestIndexVariable object at 0x7f0e01063390>
variable = <xarray.IndexVariable 'x' (x: 1)>
array(['NaT'], dtype='datetime64[ns]')
expected_value0 = numpy.datetime64('NaT'), expected_dtype = None
def _assertIndexedLikeNDArray(self, variable, expected_value0,
expected_dtype=None):
"""Given a 1-dimensional variable, verify that the variable is indexed
like a numpy.ndarray.
"""
assert variable[0].shape == ()
assert variable[0].ndim == 0
assert variable[0].size == 1
# test identity
assert variable.equals(variable.copy())
assert variable.identical(variable.copy())
# check value is equal for both ndarray and Variable
with warnings.catch_warnings():
warnings.filterwarnings('ignore', "In the future, 'NAT == x'")
> assert variable.values[0] == expected_value0
E AssertionError: assert numpy.datetime64('NaT') == numpy.datetime64('NaT')
E -numpy.datetime64('NaT')
E +numpy.datetime64('NaT')
xarray/tests/test_variable.py:143: AssertionError