New paste Repaste Download
mock_prompt = <AsyncMock name='run_pipeline' id='1818721696016'>
mock_llm_model = <AsyncMock name='read_entry' id='1818721851648'>
    @pytest.mark.asyncio
    @patch("src.schemas.llm_model.LLMModel.read_entry")
    @patch("src.schemas.prompt_model.Prompt.run_pipeline")
    async def test_get_prompt_and_model_details(mock_prompt, mock_llm_model):
        # Mock database connection
        mock_project_db = AsyncMock()
        mock_project_db.database = "mock_db"
    
        mock_prompt.return_value = [{"model_ids": ["model_1", "model_2"]}]
    
        mock_llm_model.return_value = [
            {"model_id": "model_1", "model_name": "GPT-4"},
            {"model_id": "model_2", "model_name": "Claude-2"},
        ]
    
>       result = await get_prompt_and_model_details(mock_project_db)
test_common_utils.py:326:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
..\utils\common\health_utils.py:15: in get_prompt_and_model_details
    prompt_details = await Prompt(database=project_database).run_pipeline(
..\schemas\prompt_model.py:33: in __init__
    super().__init__(database=database, **kwargs)
..\integration\database\base_model.py:81: in __init__
    self.client.get_database(self.database) if self.database else None
..\..\.venv\lib\site-packages\motor\metaprogramming.py:235: in wrapper
    result = method(self_.delegate, *args, **kwargs)
..\..\.venv\lib\site-packages\pymongo\mongo_client.py:2123: in get_database
    return database.Database(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <[AttributeError("Database has no attribute '_Database__client'. To access the _Database__client collection, use database['_Database__client'].") raised in repr()] Database object at 0x1a774457460>
client = MongoClient(host=['localhost:27017'], document_class=dict, tz_aware=False, connect=True, maxpoolsize=None, driver=DriverInfo(name='Motor', version='3.5.1', platform='asyncio'))
name = <AsyncMock id='1818721686032'>, codec_options = None, read_preference = None, write_concern = None
read_concern = None
    def __init__(
        self,
        client: MongoClient[_DocumentType],
        name: str,
        codec_options: Optional[bson.CodecOptions[_DocumentTypeArg]] = None,
        read_preference: Optional[_ServerMode] = None,
        write_concern: Optional[WriteConcern] = None,
        read_concern: Optional[ReadConcern] = None,
    ) -> None:
        """Get a database by client and name.
    
        Raises :class:`TypeError` if `name` is not an instance of
        :class:`str`. Raises :class:`~pymongo.errors.InvalidName` if
        `name` is not a valid database name.
    
        :Parameters:
          - `client`: A :class:`~pymongo.mongo_client.MongoClient` instance.
          - `name`: The database name.
          - `codec_options` (optional): An instance of
            :class:`~bson.codec_options.CodecOptions`. If ``None`` (the
            default) client.codec_options is used.
          - `read_preference` (optional): The read preference to use. If
            ``None`` (the default) client.read_preference is used.
          - `write_concern` (optional): An instance of
            :class:`~pymongo.write_concern.WriteConcern`. If ``None`` (the
            default) client.write_concern is used.
          - `read_concern` (optional): An instance of
            :class:`~pymongo.read_concern.ReadConcern`. If ``None`` (the
            default) client.read_concern is used.
    
        .. seealso:: The MongoDB documentation on `databases <https://dochub.mongodb.org/core/databases>`_.
    
        .. versionchanged:: 4.0
           Removed the eval, system_js, error, last_status, previous_error,
           reset_error_history, authenticate, logout, collection_names,
           current_op, add_user, remove_user, profiling_level,
           set_profiling_level, and profiling_info methods.
           See the :ref:`pymongo4-migration-guide`.
    
        .. versionchanged:: 3.2
           Added the read_concern option.
    
        .. versionchanged:: 3.0
           Added the codec_options, read_preference, and write_concern options.
           :class:`~pymongo.database.Database` no longer returns an instance
           of :class:`~pymongo.collection.Collection` for attribute names
           with leading underscores. You must use dict-style lookups instead::
    
               db['__my_collection__']
    
           Not:
    
               db.__my_collection__
        """
        super().__init__(
            codec_options or client.codec_options,
            read_preference or client.read_preference,
            write_concern or client.write_concern,
            read_concern or client.read_concern,
        )
    
        if not isinstance(name, str):
>           raise TypeError("name must be an instance of str")
E           TypeError: name must be an instance of str
..\..\.venv\lib\site-packages\pymongo\database.py:137: TypeError
Filename: None. Size: 5kb. View raw, , hex, or download this file.

This paste expires on 2025-02-25 05:29:56.340744. Pasted through deprecated-web.