When testing your application, you’ll often come across the need to test that your application behaves correct across a range of inputs or conditions. Instead of repetitively defining the same test scaffolding, let’s use some meta-programming to build our tests methods from a list of parameters. Nose has support for Generator Tests, but they don’t work with python’s
unittest framework. Let’s walk-through how to build our own test generator that does.
So let’s write a simple application for demonstration. We want to see if our input string is alphabetized.
Now let’s write a unit test case to check our implementation: