code: def test_decorator_validation(self):
      @serve.multiplexed
      async def get_model(model: str):
          return
  
      @serve.multiplexed(max_num_models_per_replica=1)
      async def get_model2(model: str):
          return
  
      @serve.deployment
      class MyModel:
          @serve.multiplexed
          async def get_model(model: str):
              return
  
      @serve.deployment
      class MyModel2:
          @serve.multiplexed(max_num_models_per_replica=1)
          async def get_model(self, model: str):
              return
  
      # multiplex can only be used with func or method.
      with pytest.raises(TypeError):
  
          @serve.deployment
          @serve.multiplexed
          class BadDecorator:
              pass
  
      # max_num_models_per_replica must be an integer
      with pytest.raises(TypeError):
  
          @serve.multiplexed(max_num_models_per_replica="1")
          async def get_model3(model: str):
              pass
  
      # max_num_models_per_replica must be positive
      with pytest.raises(ValueError):
  
          @serve.multiplexed(max_num_models_per_replica=0)
          async def get_model4(model: str):
              pass
  
      # multiplexed function must be async def
      with pytest.raises(TypeError):
  
          @serve.multiplexed
          def get_model5(model: str):
              pass
  
      with pytest.raises(TypeError):
  
          @serve.deployment
          class MyModel3:
              @serve.multiplexed
              def get_model(self, model: str):
                  return
  
      # no model_id argument in multiplexed function
      with pytest.raises(TypeError):
  
          @serve.multiplexed
          def get_model6():
              pass
  
      with pytest.raises(TypeError):
  
          @serve.deployment
          class MyModel4:
              @serve.multiplexed
              def get_model(self):
                  return
  
imports: import asyncio
  import os
  from typing import List
  import pytest
  import requests
  import ray
  from ray import serve
  from ray._private.test_utils import SignalActor, wait_for_condition
  from ray._private.utils import get_or_create_event_loop
  from ray.serve._private.constants import SERVE_MULTIPLEXED_MODEL_ID
  from ray.serve.context import _get_internal_replica_context
  from ray.serve.handle import RayServeHandle
  from ray.serve.multiplex import _ModelMultiplexWrapper
label_desc: Use image node_id 1 for calling the TestBasicAPI obj's underlying member method code with example usage: obj.test_decorator_validation() without return types