DictTest: remove some code duplication.