Skip to content
Snippets Groups Projects
Commit 8ebed8a5 authored by Alex Pearce's avatar Alex Pearce
Browse files

Only look for depth specifiers at string ends.

Closes #134.
parent bdc20132
No related branches found
No related tags found
1 merge request!3066Only look for depth specifiers at string ends
Pipeline #2623075 passed
......@@ -80,7 +80,7 @@ def format_output_location(l, add_depth=True):
except AttributeError:
pass
# Ensure the location ends with the depth specification `#N` or `#*`
if add_depth and not re.match(r".*#(\d+|\*)", l):
if add_depth and not re.match(r".*#(\d+|\*)$", l):
l = "{}#1".format(l)
return l
......
......@@ -19,6 +19,9 @@ def test_format_output_location():
assert format_output_location("/Event/Tracks#1") == "/Event/Tracks#1"
assert format_output_location("/Event/Tracks#93") == "/Event/Tracks#93"
assert format_output_location("/Event/Tracks#*") == "/Event/Tracks#*"
# Should ignore intermediate 'depth specifiers'
assert format_output_location(
"/Event/Tracks#1/Output") == "/Event/Tracks#1/Output#1"
# Should accept a DataHandle object as an argument
producer = Gaudi__Examples__IntDataProducer()
assert format_output_location(producer.OutputLocation) == "{}#1".format(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment