I have a testcase that looks like this:
def MyTestCase(unittest.Testcase):
def test_input01(self):
input = read_from_disk('input01')
output = run(input)
validated_output = read_from_disk('output01')
self.assertEquals(output, validated_output)
def test_input02(self):
input = read_from_disk('input02')
# ...
# and so on, for 30 inputs, from input01 to input30
Now, I understand that test code can be a bit repetitive, since simplicity is more important than conciseness. But this is becoming really error-prone, since when I decided to change the signature of some functions used here, I had to make the change in all 30 places.
I could refactor this into a loop over the known inputs, but I do want each input to remain a separate test, so I thought I should be making the test_inputxx
methods.
What am I doing wrong?