From 528b2829d4893d8d7027ea4cf26d536e6adedb24 Mon Sep 17 00:00:00 2001 From: "thierry.vo" Date: Fri, 28 Jun 2024 16:37:19 +0200 Subject: [PATCH] [*] update tests (fix pipeline) --- python/tests/test_storage_view.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/python/tests/test_storage_view.py b/python/tests/test_storage_view.py index 203982b85..8eae04a74 100644 --- a/python/tests/test_storage_view.py +++ b/python/tests/test_storage_view.py @@ -5,6 +5,9 @@ import test_utils import ctranslate2 +import logging + +LOGGER = logging.getLogger(__name__) def _assert_same_array(a, b): @@ -37,11 +40,26 @@ def test_storageview_cpu(dtype, name): with pytest.raises(AttributeError, match="CPU"): s.__cuda_array_interface__ - assert str(s) == " 1 1 1 ... 1 1 1\n[cpu:0 %s storage viewed as 2x4]" % name + expected_output = ( + "Data (2D Matrix):" + "\n[[1, 1, 1, 1], " + "\n[1, 1, 1, 1]]" + "\n[device:{}:{}, dtype:{}, storage viewed as {}x{}]" + ).format(s.device, s.device_index, name, s.shape[0], s.shape[1]) + + assert str(s) == expected_output x[0][2] = 3 x[1][3] = 8 - assert str(s) == " 1 1 3 ... 1 1 8\n[cpu:0 %s storage viewed as 2x4]" % name + + expected_output = ( + "Data (2D Matrix):" + "\n[[1, 1, 3, 1], " + "\n[1, 1, 1, 8]]" + "\n[device:{}:{}, dtype:{}, storage viewed as {}x{}]" + ).format(s.device, s.device_index, name, s.shape[0], s.shape[1]) + + assert str(s) == expected_output y = np.array(x) assert test_utils.array_equal(x, y)