Question: 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

 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

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

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!