@@ -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+
5258def 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+
89101def 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+
104124def test_aggregation_query_constructor ():
105125 client = make_client ()
106126 parent = client .collection ("dee" )
0 commit comments