Skip to content

Commit 42e877f

Browse files
committed
Added pytest testcases
1 parent 0c5fca0 commit 42e877f

2 files changed

Lines changed: 15 additions & 33 deletions

File tree

328 Bytes
Binary file not shown.
Lines changed: 15 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,20 @@
1-
import unittest
2-
from unittest import result
31
from fibo import fibonacci
42

5-
class TestFibonacci(unittest.TestCase):
6-
"""This TestCase will test the fibonacci functionality
7-
3+
def test_fibo_zero_index():
84
"""
5+
This test case will test fibonnaci zero index
6+
"""
7+
assert fibonacci(0) == 0
98

10-
def test_fibo_zero_index(self):
11-
"""
12-
This test step will test the zero index of fibonacci
13-
"""
14-
result = fibonacci(0)
15-
self.assertEqual(result , 0, "Result should be zero")
16-
17-
def test_fibo_first_index(self):
18-
"""
19-
This test step will test the first index of fibonacci
20-
"""
21-
result = fibonacci(1)
22-
self.assertEqual(result, 1, "Result should be one")
23-
24-
def test_fibo_other_indexes(self):
25-
"""
26-
This test step will test the fibonnaci with other indexes
27-
"""
28-
result = fibonacci(2)
29-
self.assertEqual(result, 1, "Result should be one")
30-
result = fibonacci(3)
31-
self.assertEqual(result, 2)
32-
result = fibonacci(4)
33-
self.assertEqual(result, 3)
34-
35-
9+
def test_fibo_first_index():
10+
"""
11+
This test case will test first index
12+
"""
13+
assert fibonacci(1) == 1
3614

37-
if __name__ == '__main__':
38-
unittest.main()
15+
def test_fibo_other_indexes():
16+
"""
17+
This will test other indexes
18+
"""
19+
assert fibonacci(2) == 1
20+
assert fibonacci(3) == 2

0 commit comments

Comments
 (0)