the is the function I want to set a test for, and it is in the .py file name_function.py
def get_formatted_name(first, last):
"""generate a neatly formatted full name"""
fullname = f"{first} {last}"
return fullname.title()
The main programe:
import unittest
from name_function import get_formatted_name as gfn
class NamesTestCase(unittest.TestCase):
"""Test For 'name_function.py'."""
def test_first_last_name(self):
"""Do names like 'Janis Joplin' work?"""
formatted_name = gfn('janis', 'joplin')
self.assertEqual(formatted_name, 'Janis Joplin')
I don't understand the block below
if __name__ == '__main__':
unittest.main()