[Piglit] [PATCH 03/20] framework: Consistently use Python 2.2+ syntax for dictionary key checks.

Jon Severinsson jon at severinsson.net
Fri Apr 12 16:39:45 PDT 2013


The old syntax is no longer supported in Python 3.x.
---
 framework/exectest.py |    2 +-
 framework/summary.py  |    6 +++---
 2 filer ändrade, 4 tillägg(+), 4 borttagningar(-)

diff --git a/framework/exectest.py b/framework/exectest.py
index b8d97b8..a8ed861 100644
--- a/framework/exectest.py
+++ b/framework/exectest.py
@@ -224,7 +224,7 @@ class PlainExecTest(ExecTest):
 			try:
 				for piglit in outpiglit:
 					if piglit.startswith('subtest'):
-						if not results.has_key('subtest'):
+						if not 'subtest' in results:
 							results['subtest'] = {}
 						results['subtest'].update(eval(piglit[7:]))
 					else:
diff --git a/framework/summary.py b/framework/summary.py
index 91e0870..a72bb4b 100644
--- a/framework/summary.py
+++ b/framework/summary.py
@@ -162,7 +162,7 @@ results is an array of GroupResult instances, one per testrun
 					# result 1:
 					#	test/group PASS
 					for r in self.results:
-						if r.has_key(name) and not isinstance(r[name], core.GroupResult):
+						if name in r and not isinstance(r[name], core.GroupResult):
 							self.createDummyGroup(r, name)
 
 					childresults = [r.get(name, core.GroupResult())
@@ -185,11 +185,11 @@ results is an array of GroupResult instances, one per testrun
 					#	test/group/c PASS
 					need_group = 0
 					for r in self.results:
-						if r.has_key(name) and not isinstance(r[name], core.TestResult):
+						if name in r and not isinstance(r[name], core.TestResult):
 							need_group = 1
 					if need_group:
 						for r in self.results:
-							if r.has_key(name) and isinstance(r[name], core.TestResult):
+							if name in r and isinstance(r[name], core.TestResult):
 								self.createDummyGroup(r, name)
 						childresults = [r.get(name, core.GroupResult())
 								for r in self.results]
-- 
1.7.10.4



More information about the Piglit mailing list