diff tests/objects.py @ 36:362912842985

start stubbing out wrappers....i am somewhat perplexed
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 07 Jun 2011 19:11:27 -0700
parents 0bea5297c156
children 5268ab85fe1b
line wrap: on
line diff
--- a/tests/objects.py	Tue Jun 07 18:58:38 2011 -0700
+++ b/tests/objects.py	Tue Jun 07 19:11:27 2011 -0700
@@ -20,3 +20,22 @@
         self.factor = a*100 + b
     def __call__(self, number):
         return number * self.factor
+
+class Wrapper(object):
+    def __init__(self, app):
+        self.app = app
+    def __call__(self, *args, **kwargs):
+        retval = self.app(*args, **kwargs)
+        values = {1: 'one',
+                  2: 'two',
+                  3: 'three'} # etc
+        if retval in values:
+            return values[retval]
+        return retval
+
+def wrap(app):
+    return Wrapper(app)
+
+def fib(n):
+    """return the nth fibonacci term"""
+