[Piglit] [RFC 04/10] framework: fix grouptools.commonprefix when len(args) == 1
Nicolai Hähnle
nhaehnle at gmail.com
Wed Oct 11 10:26:53 UTC 2017
From: Nicolai Hähnle <nicolai.haehnle at amd.com>
---
framework/grouptools.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/framework/grouptools.py b/framework/grouptools.py
index 2ee74ed9f..1a65c0dcd 100644
--- a/framework/grouptools.py
+++ b/framework/grouptools.py
@@ -82,21 +82,21 @@ def splitname(group):
i = group.rfind(SEPARATOR) + 1
head, tail = group[:i], group[i:]
head = head.rstrip(SEPARATOR)
return head, tail
def commonprefix(args):
"""Given a list of groups, returns the longest common leading component."""
if len(args) == 1:
- return args
+ return args[0]
elif any(e == '' for e in args):
return ''
common = []
for elems in zip(*[split(a) for a in args]):
iter_ = iter(elems)
first = next(iter_)
if all(first == r for r in iter_):
common.append(first)
--
2.11.0
More information about the Piglit
mailing list