Skip to content

Commit ba1d4f0

Browse files
committed
add test_parametrize_ids_iterator_without_mark
1 parent b96b7d6 commit ba1d4f0

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

testing/python/metafunc.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,26 @@ def func(x, y):
201201
("x", "y"), [("abc", "def"), ("ghi", "jkl")], ids=["one"]
202202
)
203203

204+
def test_parametrize_ids_iterator_without_mark(self):
205+
import itertools
206+
207+
def func(x, y):
208+
pass
209+
210+
it = itertools.count()
211+
212+
metafunc = self.Metafunc(func)
213+
metafunc.parametrize("x", [1, 2], ids=it)
214+
metafunc.parametrize("y", [3, 4], ids=it)
215+
ids = [x.id for x in metafunc._calls]
216+
assert ids == ["0-2", "0-3", "1-2", "1-3"]
217+
218+
metafunc = self.Metafunc(func)
219+
metafunc.parametrize("x", [1, 2], ids=it)
220+
metafunc.parametrize("y", [3, 4], ids=it)
221+
ids = [x.id for x in metafunc._calls]
222+
assert ids == ["4-6", "4-7", "5-6", "5-7"]
223+
204224
def test_parametrize_empty_list(self):
205225
"""#510"""
206226

0 commit comments

Comments
 (0)