Skip to content

Commit

Permalink
add test for the limited recursion possibilities
Browse files Browse the repository at this point in the history
  • Loading branch information
bernt-matthias committed Jan 12, 2022
1 parent be7a9a9 commit 7adee3b
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions lib/galaxy/util/xml_macros.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,33 @@ def _expand_yield_statements(macro_def, expand_el):
<content_of_token2/>
<more_content_of_token2/>
</xml>
>>> # test recursion like replacements
>>> expand_el = XML('''
... <expand macro="test">
... <token name="token1">
... <T1><yield name="token2"/></T1>
... </token>
... <token name="token2">
... <T2><yield/></T2>
... </token>
... <T/>
... </expand>''')
>>> macro_def = XML('''
... <xml name="test">
... <A><yield name="token1"/></A>
... </xml>''')
>>> _expand_yield_statements(macro_def, expand_el)
>>> print(xml_to_string(macro_def, pretty=True))
<?xml version="1.0" ?>
<xml name="test">
<A>
<T1>
<T2>
<T/>
</T2>
</T1>
</A>
</xml>
"""
# replace named yields
for token_el in expand_el.findall('./token'):
Expand Down

0 comments on commit 7adee3b

Please sign in to comment.