@@ -1406,20 +1406,20 @@ def test_pseudo_raw_input_tty_rawinput_true():
14061406 # for the 'set' command, and once for the 'quit' command,
14071407 # that the rest of it worked
14081408 assert m_input .call_count == 2
1409-
1409+
14101410def test_pseudo_raw_input_tty_rawinput_false ():
14111411 # gin up some input like it's coming from a tty
14121412 fakein = io .StringIO (u'{}' .format ('set\n ' ))
14131413 mtty = mock .MagicMock (name = 'isatty' , return_value = True )
14141414 fakein .isatty = mtty
14151415 mreadline = mock .MagicMock (name = 'readline' , wraps = fakein .readline )
14161416 fakein .readline = mreadline
1417-
1417+
14181418 # run the cmdloop, telling it where to get input from
14191419 app = cmd2 .Cmd (stdin = fakein )
14201420 app .use_rawinput = False
14211421 app ._cmdloop ()
1422-
1422+
14231423 # because we mocked the readline() call, we won't get the prompt
14241424 # or the name of the command in the output, so we can't check
14251425 # if its there. We assume that if readline() got called twice, once
@@ -1523,3 +1523,32 @@ def test_empty_stdin_input():
15231523
15241524 line = app .pseudo_raw_input ('(cmd2)' )
15251525 assert line == 'eof'
1526+
1527+
1528+ def test_poutput_string (base_app ):
1529+ msg = 'This is a test'
1530+ base_app .poutput (msg )
1531+ out = base_app .stdout .buffer
1532+ expected = msg + '\n '
1533+ assert out == expected
1534+
1535+ def test_poutput_zero (base_app ):
1536+ msg = 0
1537+ base_app .poutput (msg )
1538+ out = base_app .stdout .buffer
1539+ expected = str (msg ) + '\n '
1540+ assert out == expected
1541+
1542+ def test_poutput_empty_string (base_app ):
1543+ msg = ''
1544+ base_app .poutput (msg )
1545+ out = base_app .stdout .buffer
1546+ expected = msg
1547+ assert out == expected
1548+
1549+ def test_poutput_none (base_app ):
1550+ msg = None
1551+ base_app .poutput (msg )
1552+ out = base_app .stdout .buffer
1553+ expected = ''
1554+ assert out == expected
0 commit comments