test: Run py 2to3
Fix the couple python test files to support both python 2 and 3 syntax.
We could instead replace these with equivalent jq functions, but it's
simpler for now to fix the small compatibility problems.
Change-Id: I944d1b90fd1ebfbdcc679328657a332184922ee3
diff --git a/test/strip_non_applicable.py b/test/strip_non_applicable.py
index 41c21fa..4ba3b9c 100755
--- a/test/strip_non_applicable.py
+++ b/test/strip_non_applicable.py
@@ -28,20 +28,20 @@
nexti = i + 1
task=tasks[i]
- if APPLICABLE in task.keys() and task[APPLICABLE] == False:
+ if APPLICABLE in list(task.keys()) and task[APPLICABLE] == False:
del tasks[i]
nexti = i
else:
subtasks=[]
- if SUBTASKS in task.keys():
+ if SUBTASKS in list(task.keys()):
subtasks=task[SUBTASKS]
del_non_applicable(subtasks)
- if SUBTASKS in task.keys() and len(subtasks) == 0:
+ if SUBTASKS in list(task.keys()) and len(subtasks) == 0:
del task[SUBTASKS]
- if not SUBTASKS in task.keys():
- if HASPASS in task.keys() and task[HASPASS] == False:
+ if not SUBTASKS in list(task.keys()):
+ if HASPASS in list(task.keys()) and task[HASPASS] == False:
status=''
- if STATUS in task.keys():
+ if STATUS in list(task.keys()):
status = task[STATUS]
if status != 'INVALID' and status != 'DUPLICATE':
del tasks[i]
@@ -52,4 +52,4 @@
plugins=json.loads(sys.stdin.read())
roots=plugins['plugins'][0]['roots']
del_non_applicable(roots)
-print json.dumps(plugins, indent=3, separators=(',', ' : '), sort_keys=True)
+print(json.dumps(plugins, indent=3, separators=(',', ' : '), sort_keys=True))
diff --git a/test/strip_non_invalid.py b/test/strip_non_invalid.py
index dafae15..4889a50 100755
--- a/test/strip_non_invalid.py
+++ b/test/strip_non_invalid.py
@@ -26,16 +26,16 @@
nexti = i + 1
task=tasks[i]
- if SUBTASKS in task.keys():
+ if SUBTASKS in list(task.keys()):
subtasks=task[SUBTASKS]
keep_invalid(subtasks)
if len(subtasks) == 0:
del task[SUBTASKS]
status=''
- if STATUS in task.keys():
+ if STATUS in list(task.keys()):
status = task[STATUS]
- if status != 'INVALID' and not SUBTASKS in task.keys():
+ if status != 'INVALID' and not SUBTASKS in list(task.keys()):
del tasks[i]
nexti = i
@@ -44,4 +44,4 @@
plugins=json.loads(sys.stdin.read())
roots=plugins['plugins'][0]['roots']
keep_invalid(roots)
-print json.dumps(plugins, indent=3, separators=(',', ' : '), sort_keys=True)
+print(json.dumps(plugins, indent=3, separators=(',', ' : '), sort_keys=True))