Skip to content

Instantly share code, notes, and snippets.

@thuwarakeshm
Created January 2, 2022 06:21
Show Gist options
  • Save thuwarakeshm/aa10270925c42d31286dd906a28f12d2 to your computer and use it in GitHub Desktop.
Save thuwarakeshm/aa10270925c42d31286dd906a28f12d2 to your computer and use it in GitHub Desktop.
import unittest
def fib(n: int):
return n if n < 2 else fib(n - 1) + fib(n - 2)
class TestFibonacciFunction(unittest.TestCase):
def test_big_fibonacci(self):
self.assertEqual(fib(10), 55)
def test_small_fibonacci(self):
self.assertEqual(fib(1), 1)
if __name__ == "__main__":
unittest.main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment