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:
John Chilton
2015-11-18 12:25:38 +00:00
parent 73f46f4e08
commit 05f3da308d
2 changed files with 17 additions and 1 deletions
+1 -1
View File
@@ -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))
+16
View File
@@ -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('''