def test_bad_input(self): try: fibo("The rain in Spain") except TypeError: pass else: self.fail("Expected Exception TypeError not thrown")
def test_neg_input(self): try: fibo(-1) except RangeError: pass else: self.fail("Expected Exception RandgeError not thrown")
def GET(self, val): web.header('Content-Type', 'application/json') try: res = fibo(int(val)) except RangeError: raise web.notfound("Exception: RangeError") except ValueError: raise web.notfound("Exception: ValueError") return json.dumps(res)
def GET(self,val): web.header('Content-Type', 'application/json') try: res = fibo(int(val)) except RangeError: raise web.notfound("Exception: RangeError") except ValueError: raise web.notfound("Exception: ValueError") return json.dumps(res)
def test_fib2(self): self.assertEqual(fibo(2), [0, 1])
def test_fib1(self): self.assertEqual(fibo(1), [0])
def test_fib3(self): self.assertEqual(fibo(3), [0, 1, 1])
def test_fib2(self): self.assertEqual(fibo(2),[0, 1])
def test_fib1(self): self.assertEqual(fibo(1),[0])
def test_fib3(self): self.assertEqual(fibo(3),[0, 1, 1])