Question: 2 0 . Add a Test Case Look at the test script test.py . You can see that there is space for an additional test

20. Add a Test Case
Look at the test script test.py. You can see that there is space for an additional test case in the test procedure test_avg. We want you to test the function on range(10,20). To do this:
Create a tuple for range(10,20) by calling the function and converting it to a tuple.
Pass this tuple to avg using tuple expansion.
Once you have done this, run the test script again to make sure you pass the new test.
def test_avg():
"""
Test procedure for function avg().
"""
print('Testing avg()')
result = func.avg()
introcs.assert_floats_equal(0,result)
result = func.avg(7,1,4,3,6,8)
introcs.assert_floats_equal(4.833333333333333,result)
result = func.avg(-1,1,3,5)
introcs.assert_floats_equal(2.0,result)
result = func.avg(2.5)
introcs.assert_floats_equal(2.5,result)
result = func.avg(1.0,1.0,1.0)
introcs.assert_floats_equal(1.0,result)
# Test range(10,20) here
if __name__=='__main__':
test_avg()
print('Module func passed all tests.')

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!