Skip to content
This repository was archived by the owner on Mar 2, 2026. It is now read-only.

Commit 78e2266

Browse files
committed
fixed cover
1 parent a88cccb commit 78e2266

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

tests/unit/v1/test_aggregation.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ def test_count_aggregation_to_pb():
4949
assert count_aggregation._to_protobuf() == expected_aggregation_query_pb
5050

5151

52+
def test_count_aggregation_no_alias_to_pb():
53+
count_aggregation = CountAggregation(alias=None)
54+
got_pb = count_aggregation._to_protobuf()
55+
assert got_pb.alias == ""
56+
57+
5258
def test_sum_aggregation_w_field_path():
5359
"""
5460
SumAggregation should convert FieldPath inputs into strings
@@ -86,6 +92,12 @@ def test_sum_aggregation_to_pb():
8692
assert sum_aggregation._to_protobuf() == expected_aggregation_query_pb
8793

8894

95+
def test_sum_aggregation_no_alias_to_pb():
96+
sum_aggregation = SumAggregation("someref", alias=None)
97+
got_pb = sum_aggregation._to_protobuf()
98+
assert got_pb.alias == ""
99+
100+
89101
def test_avg_aggregation_to_pb():
90102
from google.cloud.firestore_v1.types import query as query_pb2
91103

@@ -101,6 +113,14 @@ def test_avg_aggregation_to_pb():
101113
assert avg_aggregation._to_protobuf() == expected_aggregation_query_pb
102114

103115

116+
def test_avg_aggregation_no_alias_to_pb():
117+
from google.cloud.firestore_v1.types import query as query_pb2
118+
119+
avg_aggregation = AvgAggregation("someref", alias=None)
120+
got_pb = avg_aggregation._to_protobuf()
121+
assert got_pb.alias == ""
122+
123+
104124
def test_aggregation_query_constructor():
105125
client = make_client()
106126
parent = client.collection("dee")

tests/unit/v1/test_watch.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,17 @@ def test_watch_close():
322322
assert inst._closed
323323

324324

325+
def test_watch_double_close():
326+
"""
327+
Calling close twice should succeed with no error
328+
"""
329+
inst = _make_watch()
330+
inst.close()
331+
inst.close()
332+
assert inst._consumer is None
333+
assert inst._rpc is None
334+
335+
325336
def test_watch__get_rpc_request_wo_resume_token():
326337
inst = _make_watch()
327338

0 commit comments

Comments
 (0)