Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions test/test_xacro.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import itertools
import math
import os.path
import pathlib
import re
import shutil
import subprocess
Expand Down Expand Up @@ -1702,6 +1703,15 @@ def test_remove_property(self):
${p}</a>'''
self.assert_matches(self.quick_xacro(src), '<a>2nd</a>')

def test_process_file_types(self):
# Test that checks process_file method with different path types
# os.path
path = os.path.join(os.path.dirname(__file__), 'emoji.xacro')
self.assert_matches(xacro.process(path), '<robot>🍔</robot>')

# pathlib.Path
path = pathlib.Path(os.path.join(os.path.dirname(__file__), 'emoji.xacro'))
self.assert_matches(xacro.process(path), '<robot>🍔</robot>')

if __name__ == '__main__':
unittest.main()
2 changes: 1 addition & 1 deletion xacro/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,7 @@ def process_file(input_file_name, **kwargs):
banner = [xml.dom.minidom.Comment(c) for c in
[" %s " % ('=' * 83),
# replace consecutive dashes with a single one to yield a XML-compliant comment string
" | This document was autogenerated by xacro from %-30s | " % re.sub(r'-+', '-', input_file_name),
" | This document was autogenerated by xacro from %-30s | " % re.sub(r'-+', '-', str(input_file_name)),
" | EDITING THIS FILE BY HAND IS NOT RECOMMENDED %-30s | " % "",
" %s " % ('=' * 83)]]
first = doc.firstChild
Expand Down
Loading