import unittest
def get_formatted_name(first, last):
"""Generate a neatly formatted full name."""
full_name = first + ' ' + last
return full_name.title()
class NamesTestCase(unittest.TestCase):
def test_first_last_name(self):
"""Can it handle the name just like 'janis', 'joplin'?"""
formatted_name = get_formatted_name('janis', 'joplin')
self.assertEqual(formatted_name, 'Janis Joplin')
unittest.main()
E
======================================================================
ERROR: C:\Users\blueky\AppData\Roaming\jupyter\runtime\kernel-0b912e59-7f08-4853-ab4c-f6e9c86edc80 (unittest.loader._FailedTest)
----------------------------------------------------------------------
AttributeError: module '__main__' has no attribute 'C:\Users\blueky\AppData\Roaming\jupyter\runtime\kernel-0b912e59-7f08-4853-ab4c-f6e9c86edc80'
----------------------------------------------------------------------
Ran 1 test in 0.002s
FAILED (errors=1)
An exception has occurred, use %tb to see the full traceback.
SystemExit: True
c:\python36-32\lib\site-packages\IPython\core\interactiveshell.py:2870: UserWarning: To exit: use 'exit', 'quit', or Ctrl-D.
warn("To exit: use 'exit', 'quit', or Ctrl-D.", stacklevel=1)
hi ,this code can't run in the jupyter-notebook.
but it runs well in other python's IDE