-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUnit testing.py
More file actions
60 lines (26 loc) · 752 Bytes
/
Unit testing.py
File metadata and controls
60 lines (26 loc) · 752 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env python
# coding: utf-8
# In[3]:
import unittest
# In[4]:
def cap_text(text):
return text.capitalize()
# In[5]:
cap_text("uzair")
# In[7]:
class TestCap(unittest.TestCase):
# test case 1
def test_one_word(self):
text = 'uzair'
result = cap_text("uzair")
self.assertEqual(result,text)
# test case 2
def text_many_word(self):
text = 'my name is uzair'
result = cap_text("my name is uzair")
self.assertEqual(result,text)
# In[12]:
# __name__ == '__main__' : this will return that either module is imported or not if yes than it will reutrn yes
if __name__ == '__main__' :
unittest.main()
# In[ ]: