MRG Use yield to generate common tests.

This is a slight improvement of the common tests. Actually more should be refactored but I think this at least gives more meaningful errors.