Skip to content

Commit 528b282

Browse files
committed
[*] update tests (fix pipeline)
1 parent 9e068ee commit 528b282

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

python/tests/test_storage_view.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
import test_utils
66

77
import ctranslate2
8+
import logging
9+
10+
LOGGER = logging.getLogger(__name__)
811

912

1013
def _assert_same_array(a, b):
@@ -37,11 +40,26 @@ def test_storageview_cpu(dtype, name):
3740
with pytest.raises(AttributeError, match="CPU"):
3841
s.__cuda_array_interface__
3942

40-
assert str(s) == " 1 1 1 ... 1 1 1\n[cpu:0 %s storage viewed as 2x4]" % name
43+
expected_output = (
44+
"Data (2D Matrix):"
45+
"\n[[1, 1, 1, 1], "
46+
"\n[1, 1, 1, 1]]"
47+
"\n[device:{}:{}, dtype:{}, storage viewed as {}x{}]"
48+
).format(s.device, s.device_index, name, s.shape[0], s.shape[1])
49+
50+
assert str(s) == expected_output
4151

4252
x[0][2] = 3
4353
x[1][3] = 8
44-
assert str(s) == " 1 1 3 ... 1 1 8\n[cpu:0 %s storage viewed as 2x4]" % name
54+
55+
expected_output = (
56+
"Data (2D Matrix):"
57+
"\n[[1, 1, 3, 1], "
58+
"\n[1, 1, 1, 8]]"
59+
"\n[device:{}:{}, dtype:{}, storage viewed as {}x{}]"
60+
).format(s.device, s.device_index, name, s.shape[0], s.shape[1])
61+
62+
assert str(s) == expected_output
4563

4664
y = np.array(x)
4765
assert test_utils.array_equal(x, y)

0 commit comments

Comments
 (0)