def test_multiline_input_quit(session): dlg = Dialogue(session) with raises(QuitRequest): multiline_input('>', quit_cmd='Q', input_fn=dlg.fake_input)
def test_multiline_input_unexpected_close_paren(session, error_str): dlg = Dialogue(session) with raises(errors.UnexpectedCloseParen) as excinfo: multiline_input(input_fn=dlg.fake_input) assert f"Unexpected close parenthesis: '{error_str}'." == str( excinfo.value)
def test_multiline_input(capsys, session, result): dlg = Dialogue(session) got = multiline_input('1|', '2|', input_fn=dlg.fake_input) assert result == got captured = capsys.readouterr() assert dlg.session == captured.out