# Path: tests/unit/v1/test__helpers.py
# class AsyncIter:
#     """Utility to help recreate the effect of an async generator. Useful when
#     you need to mock a system that requires `async for`.
#     """
# 
#     def __init__(self, items):
#         self.items = items
# 
#     async def __aiter__(self):
#         for i in self.items:
#             yield i
# 
# Path: tests/unit/v1/test__helpers.py
# class AsyncMock(mock.MagicMock):
#     async def __call__(self, *args, **kwargs):
#         return super(AsyncMock, self).__call__(*args, **kwargs)


import datetime
import types
import mock
import pytest
    import google.auth.credentials
from tests.unit.v1.test__helpers import AsyncIter
from tests.unit.v1.test__helpers import AsyncMock
    from google.cloud.firestore_v1.async_client import AsyncClient
    from google.cloud.firestore_v1.async_client import _CLIENT_INFO
    from google.cloud.firestore_v1.async_client import DEFAULT_DATABASE
    from google.api_core.client_options import ClientOptions
    from google.cloud.firestore_v1.async_collection import AsyncCollectionReference
    from google.cloud.firestore_v1.async_collection import AsyncCollectionReference
    from google.cloud.firestore_v1.async_collection import AsyncCollectionReference
    from google.cloud.firestore_v1.async_document import AsyncDocumentReference
    from google.cloud.firestore_v1.async_document import AsyncDocumentReference
    from google.cloud.firestore_v1.async_document import AsyncDocumentReference
    from google.cloud.firestore_v1.async_collection import AsyncCollectionReference
    from google.cloud.firestore_v1 import _helpers
    from google.api_core.retry import Retry
    from google.cloud.firestore_v1 import _helpers
    from google.cloud.firestore_v1.types import common
    from google.cloud.firestore_v1.async_document import DocumentSnapshot
    from google.api_core.retry import Retry
    from google.cloud.firestore_v1.base_client import _BAD_DOC_TEMPLATE
    from google.cloud.firestore_v1.bulk_writer import BulkWriter
    from google.cloud.firestore_v1.types import document
    from google.cloud.firestore_v1.types import firestore
    from google.cloud.firestore_v1.types import document
    from google.cloud.firestore_v1.types import firestore
    from google.cloud.firestore_v1.async_batch import AsyncWriteBatch
    from google.cloud.firestore_v1.async_transaction import AsyncTransaction
    from google.cloud.firestore_v1.types import firestore
    from google.cloud.firestore_v1.types import document
    from google.cloud._helpers import _datetime_to_pb_timestamp
    from google.cloud.firestore_v1 import _helpers
        request={
            "database": client._database_string,
            "documents": doc_paths,
            "mask": None,
            "transaction": None,
        },
        metadata=client._rpc_metadata,
    )


def test_asyncclient_bulk_writer():
    """BulkWriter is opaquely async and thus does not have a dedicated
    async variant."""

    client = _make_default_async_client()
    bulk_writer = client.bulk_writer()
    assert isinstance(bulk_writer, BulkWriter)
    assert bulk_writer._client is client._sync_copy


def test_asyncclient_sync_copy():
    client = _make_default_async_client()
    # Multiple calls to this method should return the same cached instance.
    assert client._to_sync_copy() is client._to_sync_copy()


@pytest.mark.asyncio
async def test_asyncclient_recursive_delete():

    client = _make_default_async_client()

# Path: tests/unit/v1/test__helpers.py
# class AsyncIter:
#     """Utility to help recreate the effect of an async generator. Useful when
#     you need to mock a system that requires `async for`.
#     """
# 
#     def __init__(self, items):
#         self.items = items
# 
#     async def __aiter__(self):
#         for i in self.items:
#             yield i
# 
# Path: tests/unit/v1/test__helpers.py
# class AsyncMock(mock.MagicMock):
#     async def __call__(self, *args, **kwargs):
#         return super(AsyncMock, self).__call__(*args, **kwargs)


# Path: tests/unit/v1/test_async_client.py
import datetime
import types
import mock
import pytest
    import google.auth.credentials
from tests.unit.v1.test__helpers import AsyncIter
from tests.unit.v1.test__helpers import AsyncMock
    from google.cloud.firestore_v1.async_client import AsyncClient
    from google.cloud.firestore_v1.async_client import _CLIENT_INFO
    from google.cloud.firestore_v1.async_client import DEFAULT_DATABASE
    from google.api_core.client_options import ClientOptions
    from google.cloud.firestore_v1.async_collection import AsyncCollectionReference
    from google.cloud.firestore_v1.async_collection import AsyncCollectionReference
    from google.cloud.firestore_v1.async_collection import AsyncCollectionReference
    from google.cloud.firestore_v1.async_document import AsyncDocumentReference
    from google.cloud.firestore_v1.async_document import AsyncDocumentReference
    from google.cloud.firestore_v1.async_document import AsyncDocumentReference
    from google.cloud.firestore_v1.async_collection import AsyncCollectionReference
    from google.cloud.firestore_v1 import _helpers
    from google.api_core.retry import Retry
    from google.cloud.firestore_v1 import _helpers
    from google.cloud.firestore_v1.types import common
    from google.cloud.firestore_v1.async_document import DocumentSnapshot
    from google.api_core.retry import Retry
    from google.cloud.firestore_v1.base_client import _BAD_DOC_TEMPLATE
    from google.cloud.firestore_v1.bulk_writer import BulkWriter
    from google.cloud.firestore_v1.types import document
    from google.cloud.firestore_v1.types import firestore
    from google.cloud.firestore_v1.types import document
    from google.cloud.firestore_v1.types import firestore
    from google.cloud.firestore_v1.async_batch import AsyncWriteBatch
    from google.cloud.firestore_v1.async_transaction import AsyncTransaction
    from google.cloud.firestore_v1.types import firestore
    from google.cloud.firestore_v1.types import document
    from google.cloud._helpers import _datetime_to_pb_timestamp
    from google.cloud.firestore_v1 import _helpers

        request={
            "database": client._database_string,
            "documents": doc_paths,
            "mask": None,
            "transaction": None,
        },
        metadata=client._rpc_metadata,
    )


def test_asyncclient_bulk_writer():
    """BulkWriter is opaquely async and thus does not have a dedicated
    async variant."""

    client = _make_default_async_client()
    bulk_writer = client.bulk_writer()
    assert isinstance(bulk_writer, BulkWriter)
    assert bulk_writer._client is client._sync_copy


def test_asyncclient_sync_copy():
    client = _make_default_async_client()
    # Multiple calls to this method should return the same cached instance.
    assert client._to_sync_copy() is client._to_sync_copy()


@pytest.mark.asyncio
async def test_asyncclient_recursive_delete():

    client = _make_default_async_client()

    client._firestore_api_internal = AsyncMock(spec=["run_query"])