Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Requirements For this project, you will write a test function, test_sscount. test_sscount will automate testing of sscount and sscount from the posted solution for problem

image text in transcribedimage text in transcribed

Requirements For this project, you will write a test function, test_sscount. test_sscount will automate testing of sscount and sscount from the posted solution for problem 3-4. test_sscount will each have three parameters. The first parameter is f, a function which will be sscount or sscountl. (As you will see in lab this week, Python functions can be passed as arguments to a function in the same way as other data types.) The second argument is args, a string with the needle and the haystack strings, separated by one space character. The final argument is expected result, an integer which is the expected result of calling one of the sscount functions for the needle and haystack strings in args. test_sscount will call f for the needle and haystack string in args, and compare the result returned by f to the expected result. For each test case, test_sscount should report whether the actual result matches the expected result, for example, testing sscounto Checking sses assesses ... its value 2 is correct! Function test_sscount should return None. Next, write a main function that calls test sscount two times - once to test sscounto and once to test sscounti, for a series of test cases. For example, test_sscount (p34.sscounto, 'sses assesses', 2) test_sscount (p34.sscount, 'sses assesses', 2) main should include calls to test_sscount for at least the following test cases (and expected results): 'sses assesses', 2 'an trans-Panamanian banana', 6 'needle haystack', 0 '!!! !!!!!', 3 'o pneumonoultramicroscopicsilicovolcanoconiosis', 9 "', 0 'a', O "abc', 0 'a a', 1 Note that at least one of the edge cases will reveal an issue with the posted solutions and/or the specification for project 3-4. Comment on this in your .py file. The last line in your .py file should be a call to function main. Requirements For this project, you will write a test function, test_sscount. test_sscount will automate testing of sscount and sscount from the posted solution for problem 3-4. test_sscount will each have three parameters. The first parameter is f, a function which will be sscount or sscountl. (As you will see in lab this week, Python functions can be passed as arguments to a function in the same way as other data types.) The second argument is args, a string with the needle and the haystack strings, separated by one space character. The final argument is expected result, an integer which is the expected result of calling one of the sscount functions for the needle and haystack strings in args. test_sscount will call f for the needle and haystack string in args, and compare the result returned by f to the expected result. For each test case, test_sscount should report whether the actual result matches the expected result, for example, testing sscounto Checking sses assesses ... its value 2 is correct! Function test_sscount should return None. Next, write a main function that calls test sscount two times - once to test sscounto and once to test sscounti, for a series of test cases. For example, test_sscount (p34.sscounto, 'sses assesses', 2) test_sscount (p34.sscount, 'sses assesses', 2) main should include calls to test_sscount for at least the following test cases (and expected results): 'sses assesses', 2 'an trans-Panamanian banana', 6 'needle haystack', 0 '!!! !!!!!', 3 'o pneumonoultramicroscopicsilicovolcanoconiosis', 9 "', 0 'a', O "abc', 0 'a a', 1 Note that at least one of the edge cases will reveal an issue with the posted solutions and/or the specification for project 3-4. Comment on this in your .py file. The last line in your .py file should be a call to function main

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_2

Step: 3

blur-text-image_3

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

Question

Define the goals of persuasive speaking

Answered: 1 week ago