code: def test_invalid_role_submitted_raises(messages):
      route_config = RouteConfig(**chat_config())
      with pytest.raises(
          MlflowException,
          match=".*Must be one of 'system', 'user', or 'assistant'.*",
      ):
          MosaicMLProvider(route_config)._parse_chat_messages_to_prompt(
              messages
          )
  
imports: from unittest import mock
  import pytest
  from aiohttp import ClientTimeout
  from fastapi import HTTPException
  from fastapi.encoders import jsonable_encoder
  from pydantic import ValidationError
  from mlflow import MlflowException
  from mlflow.gateway.config import RouteConfig
  from mlflow.gateway.constants import MLFLOW_GATEWAY_ROUTE_TIMEOUT_SECONDS
  from mlflow.gateway.providers.mosaicml import MosaicMLProvider
  from mlflow.gateway.schemas import chat, completions, embeddings
  from mlflow.gateway.schemas.chat import RequestMessage
  from tests.gateway.tools import MockAsyncResponse
label_desc: Use image node_id 9 for calling a global function with example usage: test_invalid_role_submitted_raises(messages) without return types