def _assertAutonames(self, names, expected): # provide an easy way to check inputs and outputs of autonamer arr = [] for name in names: if isinstance(name, dict): row = name else: row = {'type': 'text', 'label': name, '$kuid': 'kUiD'} arr.append(row) _content = deepcopy({'survey': arr}) _named = autoname_fields(_content, in_place=False) self.assertEqual(expected, [r['name'] for r in _named]) _politely = autoname_fields_to_field(_content, to_field='$autoname') _polite_names = [field.get('$autoname') for field in _politely.get('survey')] self.assertEqual(_polite_names, [r['name'] for r in _named])