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

Commit 8895d64

Browse files
committed
adds test to improve code coverage
1 parent 6ce132e commit 8895d64

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

tests/unit/schema/wrappers/test_method.py

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,61 @@ def test_method_paged_result_field_no_page_field():
190190
assert method.paged_result_field is None
191191

192192

193+
def test_method_paged_result_field_invalid_wrapper_type():
194+
"""Validate paged_result_field() returns None if page_size/max_results wrappertypes
195+
are not allowed types.
196+
"""
197+
198+
# page_size is not allowed wrappertype
199+
parent = make_field(name="parent", type=9) # str
200+
page_size = make_field(name="page_size", type=1) # float, not allowed type
201+
page_token = make_field(name="page_token", type=9) # str
202+
foos = make_field(name="foos", message=make_message("Foo"), repeated=True)
203+
next_page_token = make_field(name="next_page_token", type=9) # str
204+
205+
input_msg = make_message(
206+
name="ListFoosRequest",
207+
fields=(
208+
parent,
209+
page_size,
210+
page_token,
211+
),
212+
)
213+
output_msg = make_message(
214+
name="ListFoosResponse",
215+
fields=(
216+
foos,
217+
next_page_token,
218+
),
219+
)
220+
method = make_method(
221+
"ListFoos",
222+
input_message=input_msg,
223+
output_message=output_msg,
224+
)
225+
assert method.paged_result_field is None
226+
227+
# max_results is not allowed wrappertype
228+
max_results = make_field(name="max_results", type=9) # str, not allowed type
229+
230+
input_msg = make_message(
231+
name="ListFoosRequest",
232+
fields=(
233+
parent,
234+
max_results,
235+
page_token,
236+
),
237+
)
238+
239+
method = make_method(
240+
"ListFoos",
241+
input_message=input_msg,
242+
output_message=output_msg,
243+
)
244+
245+
assert method.paged_result_field is None
246+
247+
193248
def test_method_paged_result_ref_types():
194249
input_msg = make_message(
195250
name="ListSquidsRequest",

0 commit comments

Comments
 (0)