From: Matthew Fernandez Date: Sat, 24 Oct 2020 19:20:04 +0000 (-0700) Subject: write readSubtests() more Pythonically X-Git-Tag: 2.46.0~20^2^2~3^2~6 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7d4fc5e5ea3b7ccb9f19765b30cb3bb707f22e86;p=graphviz write readSubtests() more Pythonically --- diff --git a/rtest/rtest.py b/rtest/rtest.py index 9bb2e5b57..1584fc211 100755 --- a/rtest/rtest.py +++ b/rtest/rtest.py @@ -63,22 +63,17 @@ def skipLines(): # Store the 3 parts in the arrays ALG, FMT, FLAGS. # Stop at a blank line def readSubtests(): - SUBTESTS = [] while True: LINE = readLine() if LINE == '': - return SUBTESTS + return if not LINE.startswith('#'): - items = LINE.split(' ') - ALG0, FMT0 = items[0: 2] - FLAGS0 = items[2:] - SUBTESTS.append( - { + ALG0, FMT0, *FLAGS0 = LINE.split(' ') + yield { 'ALG': ALG0, 'FMT': FMT0, 'FLAGS': FLAGS0, - } - ) + } def readTest(): # read test name @@ -95,7 +90,7 @@ def readTest(): else: return None - SUBTESTS = readSubtests() + SUBTESTS = list(readSubtests()) return { 'TESTNAME': TESTNAME, 'GRAPH': GRAPH,