def test_sub(self): re = 'fish' sub = 'dog' m = Matcher(re, sub) r = m.sub('I am a fish.') self.assertEqual('I am a dog.', r)