def test_get_numpy_array_asterisk_creates_new_dim():
array = DataArray(
np.random.randn(2),
dims=['x'],
attrs={'units': ''},
)
numpy_array = get_numpy_array(array, ['x', '*'])
assert numpy_array.shape == (2, 1)
assert np.all(numpy_array[:, 0] == array.values)
assert np.byte_bounds(numpy_array) == np.byte_bounds(array.values)
assert numpy_array.base is array.values
评论列表
文章目录