git » nmdb » commit 9fd09c0

In the random tests, handle history printing when there is none

author Alberto Bertogli
2008-06-04 04:28:07 UTC
committer Alberto Bertogli
2008-06-04 04:28:07 UTC
parent f815f63ee6b07d5105b0ae23f35269c433df4ea6

In the random tests, handle history printing when there is none

Signed-off-by: Alberto Bertogli <albertito@gmail.com>

tests/python/random1-cache.py +4 -1
tests/python/random1.py +4 -1

diff --git a/tests/python/random1-cache.py b/tests/python/random1-cache.py
index 3dca13c..c6bf75a 100755
--- a/tests/python/random1-cache.py
+++ b/tests/python/random1-cache.py
@@ -27,7 +27,10 @@ def checked(f):
 		try:
 			return f(k, *args, **kwargs)
 		except:
-			print history[k]
+			if k in history:
+				print history[k]
+			else:
+				print 'No history for key', k
 			raise
 	newf.__name__ = f.__name__
 	return newf
diff --git a/tests/python/random1.py b/tests/python/random1.py
index 0c53d28..b873d46 100755
--- a/tests/python/random1.py
+++ b/tests/python/random1.py
@@ -27,7 +27,10 @@ def checked(f):
 		try:
 			return f(k, *args, **kwargs)
 		except:
-			print history[k]
+			if k in history:
+				print history[k]
+			else:
+				print 'No history for key', k
 			raise
 	newf.__name__ = f.__name__
 	return newf