@@ -121,13 +121,15 @@ def iter_content(self, *args, **kwargs):
121121
122122
123123@pytest .mark .parametrize (
124- "random_split,resp_message_is_proto_plus,response_type " ,
125- [(False , True , EchoResponse ), (False , False , httpbody_pb2 . HttpBody )],
124+ "random_split,resp_message_is_proto_plus" ,
125+ [(False , True ), (False , False )],
126126)
127- def test_next_simple (random_split , resp_message_is_proto_plus , response_type ):
127+ def test_next_simple (random_split , resp_message_is_proto_plus ):
128128 if resp_message_is_proto_plus :
129+ response_type = EchoResponse
129130 responses = [EchoResponse (content = "hello world" ), EchoResponse (content = "yes" )]
130131 else :
132+ response_type = httpbody_pb2 .HttpBody
131133 responses = [
132134 httpbody_pb2 .HttpBody (content_type = "hello world" ),
133135 httpbody_pb2 .HttpBody (content_type = "yes" ),
@@ -141,23 +143,25 @@ def test_next_simple(random_split, resp_message_is_proto_plus, response_type):
141143
142144
143145@pytest .mark .parametrize (
144- "random_split,resp_message_is_proto_plus,response_type " ,
146+ "random_split,resp_message_is_proto_plus" ,
145147 [
146- (True , True , Song ),
147- (False , True , Song ),
148- (True , False , http_pb2 . HttpRule ),
149- (False , False , http_pb2 . HttpRule ),
148+ (True , True ),
149+ (False , True ),
150+ (True , False ),
151+ (False , False ),
150152 ],
151153)
152- def test_next_nested (random_split , resp_message_is_proto_plus , response_type ):
154+ def test_next_nested (random_split , resp_message_is_proto_plus ):
153155 if resp_message_is_proto_plus :
156+ response_type = Song
154157 responses = [
155158 Song (title = "some song" , composer = Composer (given_name = "some name" )),
156159 Song (title = "another song" , date_added = datetime .datetime (2021 , 12 , 17 )),
157160 ]
158161 else :
159162 # Although `http_pb2.HttpRule`` is used in the response, any response message
160163 # can be used which meets this criteria for the test of having a nested field.
164+ response_type = http_pb2 .HttpRule
161165 responses = [
162166 http_pb2 .HttpRule (
163167 selector = "some selector" ,
@@ -176,22 +180,24 @@ def test_next_nested(random_split, resp_message_is_proto_plus, response_type):
176180
177181
178182@pytest .mark .parametrize (
179- "random_split,resp_message_is_proto_plus,response_type " ,
183+ "random_split,resp_message_is_proto_plus" ,
180184 [
181- (True , True , Song ),
182- (False , True , Song ),
183- (True , False , http_pb2 . HttpRule ),
184- (False , False , http_pb2 . HttpRule ),
185+ (True , True ),
186+ (False , True ),
187+ (True , False ),
188+ (False , False ),
185189 ],
186190)
187- def test_next_stress (random_split , resp_message_is_proto_plus , response_type ):
191+ def test_next_stress (random_split , resp_message_is_proto_plus ):
188192 n = 50
189193 if resp_message_is_proto_plus :
194+ response_type = Song
190195 responses = [
191196 Song (title = "title_%d" % i , composer = Composer (given_name = "name_%d" % i ))
192197 for i in range (n )
193198 ]
194199 else :
200+ response_type = http_pb2 .HttpRule
195201 responses = [
196202 http_pb2 .HttpRule (
197203 selector = "selector_%d" % i ,
@@ -207,18 +213,17 @@ def test_next_stress(random_split, resp_message_is_proto_plus, response_type):
207213
208214
209215@pytest .mark .parametrize (
210- "random_split,resp_message_is_proto_plus,response_type " ,
216+ "random_split,resp_message_is_proto_plus" ,
211217 [
212- (True , True , Song ),
213- (False , True , Song ),
214- (True , False , http_pb2 . Http ),
215- (False , False , http_pb2 . Http ),
218+ (True , True ),
219+ (False , True ),
220+ (True , False ),
221+ (False , False ),
216222 ],
217223)
218- def test_next_escaped_characters_in_string (
219- random_split , resp_message_is_proto_plus , response_type
220- ):
224+ def test_next_escaped_characters_in_string (random_split , resp_message_is_proto_plus ):
221225 if resp_message_is_proto_plus :
226+ response_type = Song
222227 composer_with_relateds = Composer ()
223228 relateds = ["Artist A" , "Artist B" ]
224229 composer_with_relateds .relateds = relateds
@@ -234,6 +239,7 @@ def test_next_escaped_characters_in_string(
234239 Song (title = '\\ {"key": ["value",]}\\ ' , composer = composer_with_relateds ),
235240 ]
236241 else :
242+ response_type = http_pb2 .Http
237243 responses = [
238244 http_pb2 .Http (
239245 rules = [
@@ -318,3 +324,5 @@ def test_next_html(response_type):
318324 with pytest .raises (ValueError ):
319325 next (itr )
320326 mock_method .assert_called_once ()
327+
328+
0 commit comments