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