Apr-03-2019, 07:59 PM
Hi,
I am really struggling to unittest the following simple method:
I am really struggling to unittest the following simple method:
def add():
a = int(input('Enter first number '))
b= int(input('Enter second number '))
return a + bI tried the following but it failed:import unittest
from unittest.mock import patch
@patch('builtins.input', return_value='2')
@patch('builtins.input', return_value='3')
def test_add(self, a, b ):
self.assertEqual(result, 5)
