Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pierian-data

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: pierian-data/complete-python-3-bootcamp
Path: blob/master/07-Errors and Exception Handling/test_cap.py
Views: 648
1
import unittest
2
import cap
3
4
class TestCap(unittest.TestCase):
5
6
def test_one_word(self):
7
text = 'python'
8
result = cap.cap_text(text)
9
self.assertEqual(result, 'Python')
10
11
def test_multiple_words(self):
12
text = 'monty python'
13
result = cap.cap_text(text)
14
self.assertEqual(result, 'Monty Python')
15
16
def test_with_apostrophes(self):
17
text = "monty python's flying circus"
18
result = cap.cap_text(text)
19
self.assertEqual(result, "Monty Python's Flying Circus")
20
21
if __name__ == '__main__':
22
unittest.main()
23