Skip to content

Commit 62bda77

Browse files
committed
Add more tests
1 parent 3cf35a1 commit 62bda77

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

dpnp/tests/test_ndarray.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,21 @@ def test_strides(self):
108108
assert xp.full_like(a, fill_value=6) not in a
109109

110110

111+
class TestFormat:
112+
def test_basic(self):
113+
a = numpy.array(3.14159)
114+
ia = dpnp.array(a)
115+
116+
spec = ".3f"
117+
assert_equal(format(ia, spec), format(a, spec))
118+
119+
@pytest.mark.parametrize("xp", [dpnp, numpy])
120+
def test_1d(self, xp):
121+
a = xp.array([3.14159])
122+
with pytest.raises(TypeError, match="unsupported format string"):
123+
_ = format(a, ".2f")
124+
125+
111126
class TestToBytes:
112127
@pytest.mark.parametrize("order", ["C", "F", "K", "A", None])
113128
def test_roundtrip_binary_str(self, order):

0 commit comments

Comments
 (0)