Example #1
0
 def test_bad_input(self):
     try:
         fibo("The rain in Spain")
     except TypeError:
         pass
     else:
         self.fail("Expected Exception TypeError not thrown")
Example #2
0
 def test_bad_input(self):
     try:
         fibo("The rain in Spain")
     except TypeError:
         pass
     else:
         self.fail("Expected Exception TypeError not thrown")
Example #3
0
 def test_neg_input(self):
     try:
         fibo(-1)
     except RangeError:
         pass
     else:
         self.fail("Expected Exception RandgeError not thrown")
Example #4
0
 def test_neg_input(self):
     try:
         fibo(-1)
     except RangeError:
         pass
     else:
         self.fail("Expected Exception RandgeError not thrown")
Example #5
0
 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)
Example #6
0
 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)
Example #7
0
 def test_fib2(self):
     self.assertEqual(fibo(2), [0, 1])
Example #8
0
 def test_fib1(self):
     self.assertEqual(fibo(1), [0])
Example #9
0
 def test_fib3(self):
     self.assertEqual(fibo(3), [0, 1, 1])
Example #10
0
 def test_fib2(self):
     self.assertEqual(fibo(2),[0, 1])
Example #11
0
 def test_fib1(self):
     self.assertEqual(fibo(1),[0])
Example #12
0
 def test_fib3(self):
     self.assertEqual(fibo(3),[0, 1, 1])