From 0d15eab61d88ff77641a06d6052341352bed61d7 Mon Sep 17 00:00:00 2001 From: TanyaAgarwal28 <8979149361t@gmail.com> Date: Sun, 8 Oct 2023 18:14:16 +0530 Subject: [PATCH] Bug Fix 11456: Duplicated parameters in @pytest.mark.parametrize --- testing/acceptance_test.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index 429fb4e43..7a3bbad65 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -341,6 +341,34 @@ class TestGeneralUsage: assert res.ret == 0 res.stdout.fnmatch_lines(["*1 passed*"]) + def test_direct_addressing_selects_duplicates(self, pytester: Pytester) -> None: + p = pytester.makepyfile( + """ + import pytest + + @pytest.mark.parametrize("a", [1, 2, 10, 11, 2, 1, 12, 11]) + def test_func(a): + pass + """ + ) + res = pytester.runpytest(p.name + "::" + "test_func[1]") + assert res.ret == 0 + res.stdout.fnmatch_lines(["*1 passed*"]) + + def test_direct_addressing_selects_duplicates_1(self, pytester: Pytester) -> None: + p = pytester.makepyfile( + """ + import pytest + + @pytest.mark.parametrize("a", [1, 2, 10, 11, 2, 1, 12, 1_1,2_1]) + def test_func(a): + pass + """ + ) + res = pytester.runpytest(p.name + "::" + "test_func[1]") + assert res.ret == 0 + res.stdout.fnmatch_lines(["*1 passed*"]) + def test_direct_addressing_notfound(self, pytester: Pytester) -> None: p = pytester.makepyfile( """