code: def test_search_registered_model_pagination(store):
      rms = [_rm_maker(store, f"RM{i:03}").name for i in range(50)]
  
      # test flow with fixed max_results
      returned_rms = []
      query = "name LIKE 'RM%'"
      result, token = _search_registered_models(
          store, query, page_token=None, max_results=5
      )
      returned_rms.extend(result)
      while token:
          result, token = _search_registered_models(
              store, query, page_token=token, max_results=5
          )
          returned_rms.extend(result)
      assert rms == returned_rms
  
      # test that pagination will return all valid results in sorted order
      # by name ascending
      result, token1 = _search_registered_models(
          store, query, max_results=5
      )
      assert token1 is not None
      assert result == rms[0:5]
  
      result, token2 = _search_registered_models(
          store, query, page_token=token1, max_results=10
      )
      assert token2 is not None
      assert result == rms[5:15]
  
      result, token3 = _search_registered_models(
          store, query, page_token=token2, max_results=20
      )
      assert token3 is not None
      assert result == rms[15:35]
  
      result, token4 = _search_registered_models(
          store, query, page_token=token3, max_results=100
      )
      # assert that page token is None
      assert token4 is None
      assert result == rms[35:]
  
      # test that providing a completely invalid page token throws
      with pytest.raises(
          MlflowException,
          match=r"Invalid page token, could not base64-decode",
      ) as exception_context:
          _search_registered_models(
              store, query, page_token="evilhax", max_results=20
          )
      assert exception_context.value.error_code == ErrorCode.Name(
          INVALID_PARAMETER_VALUE
      )
  
      # test that providing too large of a max_results throws
      with pytest.raises(
          MlflowException,
          match=r"Invalid value for request parameter max_results",
      ) as exception_context:
          _search_registered_models(
              store, query, page_token="evilhax", max_results=1e15
          )
      assert exception_context.value.error_code == ErrorCode.Name(
          INVALID_PARAMETER_VALUE
      )
  
imports: import time
  import uuid
  from unittest import mock
  import pytest
  from mlflow.entities.model_registry import ModelVersion, ModelVersionTag, RegisteredModelTag
  from mlflow.environment_variables import MLFLOW_TRACKING_URI
  from mlflow.exceptions import MlflowException
  from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE, RESOURCE_ALREADY_EXISTS, RESOURCE_DOES_NOT_EXIST, ErrorCode
  from mlflow.store.model_registry.dbmodels.models import SqlModelVersion, SqlModelVersionTag, SqlRegisteredModel, SqlRegisteredModelTag
  from mlflow.store.model_registry.sqlalchemy_store import SqlAlchemyStore
  from tests.helper_functions import random_str
label_desc: Use image node_id 29 for calling a global function with example usage: test_search_registered_model_pagination(store) without return types