Using mock data in a python Unit Test

Hi all!

I am working on setting up a set of lesson for my classes with a final assignment being to create a short Mad Lib program where they prompt the user for words and then use those words to generate a story.

I want to be able to test this programmatically using the Unit Test feature. I know that you can use patch from the unittest.mock module to provide data without having to manually go through each student’s submission.

However, I haven’t been able to figure out how to do this from within Replit’s interface. There doesn’t appear to be way to add a decorator to the test function and change the function’s parameters. I have googled to no avail. Can someone give me some direction for how I can solve this problem? Am I just looking at it the wrong way?

Thanks!

1 Like