def test_exceptions_storyerror_escape_string(magic): string = magic() assert StoryError.escape_string(string) == string.encode().decode()
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()
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())