I have taken up Python recently.
I'm trying to use unittest.Mock()
for testing my code in PyCharm. But, PyCharm fails with the error:
requests = Mock()
TypeError: 'module' object is not callable
My program:
import requests
from unittest import Mock
requests = unittest.Mock()
def get_holidays():
r = requests.get("http://localhost/holidays")
if r.status_code == 200:
return r.json()
return None
Can anyone please help to identify where I am going wrong. Thanks