Ejemplo n.º 1
0
def test_storyerror_echo(patch, storyerror):
    """
    Ensures StoryError.echo prints StoryError.message
    """
    patch.object(click, 'echo')
    patch.object(StoryError, 'message')
    storyerror.echo()
    click.echo.assert_called_with(StoryError.message())
Ejemplo n.º 2
0
def test_parser_parser_unexpected_token(capsys, patch, magic, parser):
    patch.init(StoryError)
    patch.object(StoryError, 'message')
    patch.many(Parser, ['lark', 'transformer'])
    Parser.lark().parse.side_effect = UnexpectedToken(magic(), 'exp', 0, 1)
    with raises(SystemExit):
        parser.parse('source', debug=False)
    out, err = capsys.readouterr()
    assert out == '{}\n'.format(StoryError.message())
Ejemplo n.º 3
0
def test_exceptions_storyerror_str_(patch, error):
    patch.object(StoryError, 'message', return_value='pretty')
    assert str(error) == StoryError.message()