# 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
# 
# class AsyncMock(mock.MagicMock):
#     async def __call__(self, *args, **kwargs):
#         return super(AsyncMock, self).__call__(*args, **kwargs)


import collections
import mock
import pytest
    import google.auth.credentials
from tests.unit.v1.test__helpers import AsyncIter, AsyncMock
    from google.cloud.firestore_v1.async_document import AsyncDocumentReference
    from google.cloud.firestore_v1.types import firestore
    from google.cloud.firestore_v1.types import common
    from google.cloud.firestore_v1.types import document
    from google.cloud.firestore_v1.types import write
    from google.cloud.firestore_v1 import _helpers
    from google.cloud.firestore_v1 import _helpers
    from google.api_core.retry import Retry
    from google.cloud.firestore_v1.async_document import AsyncDocumentReference
    from google.cloud.firestore_v1.async_document import DocumentSnapshot
    from google.cloud.firestore_v1.types import common
    from google.cloud.firestore_v1.types import document
    from google.cloud.firestore_v1.types import write
    from google.cloud.firestore_v1 import _helpers
    from google.cloud.firestore_v1 import _helpers
    from google.api_core.retry import Retry
    from google.cloud.firestore_v1.types import common
    from google.cloud.firestore_v1.types import document
    from google.cloud.firestore_v1.types import write
    from google.cloud.firestore_v1 import _helpers
    from google.cloud.firestore_v1 import _helpers
    from google.cloud.firestore_v1.transforms import DELETE_FIELD
    from google.api_core.retry import Retry
    from google.protobuf import timestamp_pb2
    from google.cloud.firestore_v1 import _helpers
    from google.cloud.firestore_v1.types import write
    from google.protobuf import timestamp_pb2
    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.types import document
    from google.cloud.firestore_v1.types import firestore
    from google.cloud.firestore_v1.transaction import Transaction
    from google.api_core.retry import Retry
    from google.cloud.firestore_v1 import _helpers
    from google.cloud.firestore_v1.async_collection import AsyncCollectionReference
    from google.api_core.retry import Retry
    from google.cloud.firestore_v1.async_client import AsyncClient
    client._firestore_api_internal = firestore_api
    document_reference = _make_async_document_reference(
        "where", "we-are", client=client
    )
    response.found.name = None if not_found else document_reference._document_path
    response.missing = document_reference._document_path if not_found else None

    def WhichOneof(val):
        return "missing" if not_found else "found"

    response._pb = response
    response._pb.WhichOneof = WhichOneof
    firestore_api.batch_get_documents.return_value = AsyncIter(
        [response] if not return_empty else []
    )

    if use_transaction:
        transaction = Transaction(client)
        transaction_id = transaction._id = b"asking-me-2"
    else:
        transaction = None

    kwargs = _helpers.make_retry_timeout_kwargs(retry, timeout)

    snapshot = await document_reference.get(
        field_paths=field_paths, transaction=transaction, **kwargs,
    )

    assert snapshot.reference is document_reference
    if not_found or return_empty:

# 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
# 
# class AsyncMock(mock.MagicMock):
#     async def __call__(self, *args, **kwargs):
#         return super(AsyncMock, self).__call__(*args, **kwargs)


# Path: tests/unit/v1/test_async_document.py
import collections
import mock
import pytest
    import google.auth.credentials
from tests.unit.v1.test__helpers import AsyncIter, AsyncMock
    from google.cloud.firestore_v1.async_document import AsyncDocumentReference
    from google.cloud.firestore_v1.types import firestore
    from google.cloud.firestore_v1.types import common
    from google.cloud.firestore_v1.types import document
    from google.cloud.firestore_v1.types import write
    from google.cloud.firestore_v1 import _helpers
    from google.cloud.firestore_v1 import _helpers
    from google.api_core.retry import Retry
    from google.cloud.firestore_v1.async_document import AsyncDocumentReference
    from google.cloud.firestore_v1.async_document import DocumentSnapshot
    from google.cloud.firestore_v1.types import common
    from google.cloud.firestore_v1.types import document
    from google.cloud.firestore_v1.types import write
    from google.cloud.firestore_v1 import _helpers
    from google.cloud.firestore_v1 import _helpers
    from google.api_core.retry import Retry
    from google.cloud.firestore_v1.types import common
    from google.cloud.firestore_v1.types import document
    from google.cloud.firestore_v1.types import write
    from google.cloud.firestore_v1 import _helpers
    from google.cloud.firestore_v1 import _helpers
    from google.cloud.firestore_v1.transforms import DELETE_FIELD
    from google.api_core.retry import Retry
    from google.protobuf import timestamp_pb2
    from google.cloud.firestore_v1 import _helpers
    from google.cloud.firestore_v1.types import write
    from google.protobuf import timestamp_pb2
    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.types import document
    from google.cloud.firestore_v1.types import firestore
    from google.cloud.firestore_v1.transaction import Transaction
    from google.api_core.retry import Retry
    from google.cloud.firestore_v1 import _helpers
    from google.cloud.firestore_v1.async_collection import AsyncCollectionReference
    from google.api_core.retry import Retry
    from google.cloud.firestore_v1.async_client import AsyncClient

    client._firestore_api_internal = firestore_api
    document_reference = _make_async_document_reference(
        "where", "we-are", client=client
    )
    response.found.name = None if not_found else document_reference._document_path
    response.missing = document_reference._document_path if not_found else None

    def WhichOneof(val):
        return "missing" if not_found else "found"

    response._pb = response
    response._pb.WhichOneof = WhichOneof
    firestore_api.batch_get_documents.return_value = AsyncIter(
        [response] if not return_empty else []
    )

    if use_transaction:
        transaction = Transaction(client)
        transaction_id = transaction._id = b"asking-me-2"
    else:
        transaction = None

    kwargs = _helpers.make_retry_timeout_kwargs(retry, timeout)

    snapshot = await document_reference.get(
        field_paths=field_paths, transaction=transaction, **kwargs,
    )

    assert snapshot.reference is document_reference
    if not_found or return_empty:

        assert snapshot._data is None