Question: for the following code add 2 test cases that will use to the test the return add pair function after test one and then modify

for the following code add 2 test cases that will use to the test the return add pair function after test one and then modify the function of return add pair to include a space between the + sign such as 1+2 vs 2+1 and update the code until the tests can pass:

import unittest print 'Assignment 3 Python reference code'

numbers = [[4, 3], [1,2], [154,233], [555,-444], [555,-444]]

def return_add_pair(pair): return str(pair[0]) + '+' + str(pair[1]) + '= ' + str(pair[0] + pair[1])

print ' return_add_pair examples' print return_add_pair(numbers[0]) print return_add_pair(numbers[1]) print return_add_pair(numbers[2]) print return_add_pair(numbers[3])

print ' Automated Test of show_add_pair'

class TestAssignment3(unittest.TestCase):

def test_one(self): self.assertEqual(return_add_pair([2, 3]), '2+3= 5')

if __name__ == '__main__': unittest.main()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!