mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Fix macro bug with empty CDATA being None instead of ''.
Fixes galaxyproject/planemo#362 thanks for the report @erasche. Test using the following command: ``` nosetests test/unit/tools/test_tool_loader.py ```
This commit is contained in:
@@ -16,7 +16,7 @@ def load(path):
|
||||
_import_macros(root, path)
|
||||
|
||||
# Collect tokens
|
||||
tokens = _macros_of_type(root, 'token', lambda el: el.text)
|
||||
tokens = _macros_of_type(root, 'token', lambda el: el.text or '')
|
||||
|
||||
# Expand xml macros
|
||||
macro_dict = _macros_of_type(root, 'xml', lambda el: XmlMacroDef(el))
|
||||
|
||||
@@ -216,6 +216,22 @@ def test_loader():
|
||||
value = tag_el.get('value')
|
||||
assert value == "The value.", value
|
||||
|
||||
with TestToolDirectory() as tool_dir:
|
||||
tool_dir.write('''
|
||||
<tool>
|
||||
<macros>
|
||||
<token name="@TAG_VAL@"><![CDATA[]]></token>
|
||||
</macros>
|
||||
<another>
|
||||
<tag value="@TAG_VAL@" />
|
||||
</another>
|
||||
</tool>
|
||||
''')
|
||||
xml = tool_dir.load()
|
||||
tag_el = xml.find("another").find("tag")
|
||||
value = tag_el.get('value')
|
||||
assert value == "", value
|
||||
|
||||
# Test macros XML macros with $$ expansions in attributes
|
||||
with TestToolDirectory() as tool_dir:
|
||||
tool_dir.write('''
|
||||
|
||||
Reference in New Issue
Block a user