Skip to content

Commit 77ca003

Browse files
MAINT: Apply ruff/flake8-comprehensions rule C417
C417 Unnecessary `map` usage (rewrite using a generator expression)
1 parent 87000d6 commit 77ca003

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

numpy/_core/tests/test_multiarray.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5478,7 +5478,7 @@ def test_roundtrip_str(self, x):
54785478

54795479
def test_roundtrip_repr(self, x):
54805480
x = x.real.ravel()
5481-
s = "@".join(map(lambda x: repr(x)[11:-1], x))
5481+
s = "@".join((repr(x)[11:-1] for x in x))
54825482
y = np.fromstring(s, sep="@")
54835483
assert_array_equal(x, y)
54845484

numpy/_core/tests/test_shape_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def test_generator(self):
156156
with pytest.raises(TypeError, match="arrays to stack must be"):
157157
hstack(np.arange(3) for _ in range(2))
158158
with pytest.raises(TypeError, match="arrays to stack must be"):
159-
hstack(map(lambda x: x, np.ones((3, 2))))
159+
hstack((x for x in np.ones((3, 2))))
160160

161161
def test_casting_and_dtype(self):
162162
a = np.array([1, 2, 3])

0 commit comments

Comments
 (0)