'Test a decorated function in Python
I have a Python function which is decorated.
@retry_if_access_token_expired(app_id)
def add_something(
self,
*,
argument1,
argument1 = None,
):
"""adding something"""
I've written tests for the given as below.
@patch("other inside function to mock")
@patch("other inside function to mock 2")
def test_add_something(
self, mock_1, mock_2
):
""" some logic to test the add something method """
But I am getting this error that says add_something takes one positional argument:
TypeError: add_something() takes 1 positional argument but 3 were given
How can I fix it?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
