Nov-19-2019, 04:35 PM
Hi There! When unittest'ing a simple program that prompts for a first and last name, I'm getting a "repl process died unexpectedly" return.
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 |
def get_formatted_name (first, last): """Generate a neatly formatted full name.""" full_name = first + ' ' + last return full_name.title() from main import get_formatted_name print ( "Enter 'q' at any time to quit." ) while True : first = input ( "\nPlease give me your first name: " ) if first = = 'q' : break last = input ( "Please give me your last name: " ) if last = = 'q' : break formatted_name = get_formatted_name(first, last) print ( f "\tNeatly formatted name: " + formatted_name + '.' ) import unittest from main import get_formatted_name class NamesTestCase(unittest.TestCase): """Tests for 'main.py'.""" def test_first_last_name( self ): """Do names like 'Janis Joplin' work?""" formatted_name = get_formatted_name( 'janis' , 'joplin' ) self .assertEqual(formatted_name, 'Janis Joplin' ) unittest.main() |
Error:----------------------------------------------------------------------
Ran 0 tests in 0.000s
OK
repl process died unexpectedly: