Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
26 lines (19 sloc) 670 Bytes
import unittest
def fibonacci(n: int) -> int:
if n > 2:
return fibonacci(n - 1) + fibonacci(n - 2)
return 1
class TestFibonacci(unittest.TestCase):
def test_numbers(self):
self.assertEqual(1, fibonacci(1))
self.assertEqual(1, fibonacci(2))
self.assertEqual(2, fibonacci(3))
self.assertEqual(3, fibonacci(4))
self.assertEqual(5, fibonacci(5))
self.assertEqual(8, fibonacci(6))
self.assertEqual(13, fibonacci(7))
self.assertEqual(21, fibonacci(8))
self.assertEqual(34, fibonacci(9))
self.assertEqual(55, fibonacci(10))
if __name__ == '__main__':
unittest.main()
You can’t perform that action at this time.