Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions