I am trying to parametrize unit tests in Python using parameterize library and unittest framework. I need to patch certain functions and I use the following which works
@parameterized.expand([
[a1, b1],
[a2, b2]
])
@patch("package.module.f2")
@patch("package.module.f1")
def test_my_func(self, a, b, f1, f2):
f1.return_value = "Hello"
f2.return_value = "World"
However, the order of arguments in this working case is a bit weird. Generally while patching the arguments are passed from bottom to top. But when I use parameterize, along with patch, I had expected something like
@parameterized.expand([
[a1, b1],
[a2, b2]
])
@patch("package.module.f2")
@patch("package.module.f1")
def test_my_func(self, f1, f2, a, b):
f1.return_value = "Hello"
f2.return_value = "World"
but it doesn't work. Can somebody please explain?
Thanks