Python Forum
pytest, parametrize, neasted list
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pytest, parametrize, neasted list
#1
Hi, I tried to write little test:
li_1=([[1, 3, 2], [3, 5, 6]],[[2,6]])
li_der_1=[[2,6]]

@pytest.mark.parametrize("lite,expected",(li_1,li_der_1))
def test_der_li(lite,expected):
    assert der_li(lite)==expected
and I have problem:
Error:
platform win32 -- Python 3.7.7, pytest-5.4.1, py-1.8.1, pluggy-0.13.1 -- C:\Users\karol\anaconda3\envs\porjekt ostateczny\python.exe cachedir: .pytest_cache rootdir: C:\Users\karol\PycharmProjects\MES collecting ... test_szczegolna_interpolacja_hermita.py:None (test_szczegolna_interpolacja_hermita.py) test_szczegolna_interpolacja_hermita.py::test_der_li: in "parametrize" the number of names (2): ['lite', 'expected'] must be equal to the number of values (1): [[2, 6]] collected 0 items / 1 error
How to pass these arguments corectly?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Pytest Installed, but VS Code Won’t Access Pytest AstralWeeks 9 2,895 Sep-13-2023, 03:00 PM
Last Post: AstralWeeks
  Pytest mocks anthonyrmoss78 0 427 May-30-2023, 08:28 PM
Last Post: anthonyrmoss78
  How to run a pytest test for each item in a list arielma 0 2,326 Jan-06-2021, 10:40 PM
Last Post: arielma
  Pytest and rootdirectory Master_Sergius 4 4,565 Jun-01-2020, 05:05 PM
Last Post: Master_Sergius
  Pytest with requests a21250450 3 2,731 Mar-21-2019, 03:24 PM
Last Post: buran
  pytest and caplog lazyliv 0 3,050 May-16-2018, 02:36 PM
Last Post: lazyliv

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020