summary refs log tree commit diff stats
path: root/test4.py
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2009-12-11 13:36:48 +0100
committerhut <hut@lavabit.com>2009-12-11 13:36:48 +0100
commitf58626842bbb2bd3f8446044a44a67180b737f4e (patch)
tree74ab897879a3b151488c8348759442396ef3336b /test4.py
parent0c0b9489072922c0f597c7099f8728868ffbb4a4 (diff)
downloadranger-f58626842bbb2bd3f8446044a44a67180b737f4e.tar.gz
moved/fixed tests
Diffstat (limited to 'test4.py')
-rw-r--r--test4.py36
1 files changed, 0 insertions, 36 deletions
diff --git a/test4.py b/test4.py
deleted file mode 100644
index b2390a03..00000000
--- a/test4.py
+++ /dev/null
@@ -1,36 +0,0 @@
-import random, time
-
-class DelValue():
-	def a(d):
-		return dict((k, v) for k, v in d.items() if v is not 0)
-
-	def b(d):
-		for k, v in d.copy().items():
-			if v == 0: del d[k]
-		return d
-
-	def c(d):
-		for k in tuple(d.keys()):
-			if d[k] == 0: del d[k]
-		return d
-
-	def d(d):
-		for k, v in tuple(d.items()):
-			if v == 0: del d[k]
-		return d
-
-
-basedict = {}
-for i in range(200):
-	basedict[i] = random.randint(0, 1)
-
-expected = DelValue.a(basedict.copy())
-
-for algo in ['a', 'b', 'c', 'd']:
-	copy = basedict.copy()
-	t = time.time()
-	for i in range(100):
-		assert DelValue.__dict__[algo](copy) == expected
-	print("algorithm %s: %f" % (algo, time.time() - t))
-
-# c it is, although b is faster with smaller dictionaries