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
| import unittest
def fix_str(param):
return param # TODO: write the real code.
def fix_list_str(param):
return param # TODO: write the real code.
def fix_list_list_str(param):
return param # TODO: write the real code.
class TestMyFunctions(unittest.TestCase):
def test_fix_str(self):
self.assertEqual(fix_str("B'RUNA"), "BRUNA")
self.assertEqual(fix_str('PAUL'), 'PAUL')
self.assertEqual(fix_str('20/12/1954'), '20/12/1954')
def test_fix_list_str(self):
param = ["B'RUNA", 'PAUL', '20/12/1954', 'NICE', '58']
result = fix_list_str(param)
expected = ["BRUNA", 'PAUL', '20/12/1954', 'NICE', '58']
self.assertEqual(result, expected)
def test_fix_list_list_str(self):
param = [
['NOM', 'PRENOM', 'NAISSANCE', 'VILLE', 'AGE'],
["B'RUNA", 'PAUL', '20/12/1954', 'NICE', '58']
]
result = fix_list_list_str(param)
expected = [
['NOM', 'PRENOM', 'NAISSANCE', 'VILLE', 'AGE'],
["BRUNA", 'PAUL', '20/12/1954', 'NICE', '58']
]
self.assertEqual(result, expected)
if __name__ == "__main__":
unittest.main() |
Partager