Zipcoder
/
zip-code-wilmington-classroom-5-assessment-1-python-PythonFundamentals.Exams.Exam1
Public
generated from ZipCodeCore/PythonFundamentals.Exams.Exam1
-
Notifications
You must be signed in to change notification settings - Fork 6
/
test_cases.py
34 lines (25 loc) · 987 Bytes
/
test_cases.py
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
import unittest
from exam1 import cases
class CasesTest(unittest.TestCase):
def test_camel_to_snake(self):
test_cases = [
('python', 'python'),
('zipCode', 'zip_code'),
('desaBurton', 'desa_burton'),
('dataEngineeringWithPython', 'data_engineering_with_python'),
]
for word, expected in test_cases:
with self.subTest(f"{word} -> {expected}"):
self.assertEqual(expected, cases.camel2snake(word))
def test_snake_to_camel(self):
test_cases = [
('zz', 'zz'),
('python', 'python'),
('zip_code', 'zipCode'),
('wilmington_delaware', 'wilmingtonDelaware'),
('holy_smokes', 'holySmokes'),
('this_is_silly', 'thisIsSilly'),
]
for word, expected in test_cases:
with self.subTest(f"{word} -> {expected}"):
self.assertEqual(expected, cases.snake2camel(word))