Remove repetition and make preprocess tests more readable.