Skip to content

Commit

Permalink
test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Linchin committed Sep 6, 2024
1 parent a0ff04a commit 666c727
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions tests/unit/v1/test_async_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,22 +436,9 @@ async def test_asynccollectionreference_get_with_transaction(query_class):
@mock.patch("google.cloud.firestore_v1.async_query.AsyncQuery", autospec=True)
@pytest.mark.asyncio
async def test_asynccollectionreference_get_w_explain_options(query_class):
from google.cloud.firestore_v1.async_stream_generator import AsyncStreamGenerator
from google.cloud.firestore_v1.query_profile import ExplainOptions
import google.cloud.firestore_v1.types.query_profile as query_profile_pb2

explain_options = ExplainOptions(analyze=True)
explain_metrics = query_profile_pb2.ExplainMetrics(
{"execution_stats": {"results_returned": 1}}
)

async def response_generator():
for item in [1, 2, 3, explain_metrics]:
yield item

query_class.return_value.stream.return_value = AsyncStreamGenerator(
response_generator(), explain_options
)

collection = _make_async_collection_reference("collection")
await collection.get(explain_options=ExplainOptions(analyze=True))
Expand Down Expand Up @@ -537,8 +524,8 @@ async def test_asynccollectionreference_stream_w_explain_options(query_class):
)

async def response_generator():
for item in [1, 2, 3, explain_metrics]:
yield item
yield 1
yield explain_metrics

query_class.return_value.stream.return_value = AsyncStreamGenerator(
response_generator(), explain_options
Expand Down

0 comments on commit 666c727

Please sign in to comment.