]> granicus.if.org Git - graphviz/commitdiff
write readSubtests() more Pythonically
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 24 Oct 2020 19:20:04 +0000 (12:20 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 31 Oct 2020 02:15:43 +0000 (19:15 -0700)
rtest/rtest.py

index 9bb2e5b57310708e032d5eea97dacd929edc484a..1584fc211e1f3e1608015a505abcf594c906511a 100755 (executable)
@@ -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,