def consume(tree, parent, includes, excludes, substitutes): if is_node(tree, 'includes'): dfs(tree['includes'], parent, includes, lambda ref, v: to_forward_ref(ref)) if is_node(tree, 'excludes'): dfs(tree['excludes'], parent, excludes, lambda ref, v: ref) if is_node(tree, 'substitutes'): dfs(tree['substitutes'], parent, substitutes, lambda ref, v: u'{0}={1}'.format(ref, shell_escape(v)))
def test_to_forward_ref(self): """Tests the utils.to_forward_ref function""" self.assertEqual('a.', utils.to_forward_ref('a')) self.assertEqual('a*', utils.to_forward_ref('a*'))