Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import unittest
- def get_formated_name(first, last, middle =''):
- if middle:
- sklejone = first + ' ' + middle + ' ' + last
- else:
- sklejone = first + ' ' + last
- return sklejone.title()
- print('Ciskaj q jak chcesz skonczyc progam')
- while True:
- imie = input('Podaj swoje imie')
- if imie == 'q':
- break
- nazwisko = input('Podaj swoje nazwisko:')
- if nazwisko == 'q':
- break
- print(get_formated_name(imie, nazwisko))
- class NameTestCase(unittest.TestCase):
- """ Sprawdzonko czy funkcja get_formated_name działa prawidłowo, po otrzymaniu imienia i nazwiska"""
- def test_imie_nazwisko(self):
- """Czy dane w postaci Janis Joplin sa obslugiwane prawidlowo?"""
- formatted_name = get_formated_name('janis', 'joplin', 'jop')
- self.assertEqual(formatted_name, 'Janis Jop Joplin')
- unittest.main() #nakazanie pythonowi wykonanie testów zawartych w pliku
Add Comment
Please, Sign In to add comment