コード例 #1
0
def test_exceptions_storyerror_escape_string(magic):
    string = magic()
    assert StoryError.escape_string(string) == string.encode().decode()
コード例 #2
0
def test_exceptions_storyerror_message(patch, error):
    patch.many(StoryError, ['compile_template', 'escape_string'])
    result = error.message()
    StoryError.escape_string.assert_called_with(StoryError.compile_template())
    assert result == StoryError.escape_string()
コード例 #3
0
def test_exceptions_storyerror_message_reason(patch, error):
    patch.many(StoryError, ['compile_template', 'escape_string', 'reason'])
    error.error_type = 'else'
    result = error.message()
    assert result == '{}. Reason: {}'.format(StoryError.escape_string(),
                                             StoryError.reason())