本文整理匯總了Python中shiji.testutil.DummyRequest.args["page_len"]方法的典型用法代碼示例。如果您正苦於以下問題:Python DummyRequest.args["page_len"]方法的具體用法?Python DummyRequest.args["page_len"]怎麽用?Python DummyRequest.args["page_len"]使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類shiji.testutil.DummyRequest
的用法示例。
在下文中一共展示了DummyRequest.args["page_len"]方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_good_page_len_overrides_default
# 需要導入模塊: from shiji.testutil import DummyRequest [as 別名]
# 或者: from shiji.testutil.DummyRequest import args["page_len"] [as 別名]
def test_good_page_len_overrides_default(self):
"Valid page_len argument overrides page_len from default."
test_request = DummyRequest()
test_request.args["arg1"] = ["test"]
test_request.args["page_len"] = ["50"]
res = self.dummy_render_func2(test_request)
self.assertEqual(res["page_len"][0], "50")
示例2: test_page_len_gt_max_page_len_fail
# 需要導入模塊: from shiji.testutil import DummyRequest [as 別名]
# 或者: from shiji.testutil.DummyRequest import args["page_len"] [as 別名]
def test_page_len_gt_max_page_len_fail(self):
"page_len argument in request is > max_page_len."
test_request = DummyRequest()
test_request.args["arg1"] = ["test"]
test_request.args["page_len"] = ["501"]
res = self.dummy_render_func2(test_request)
self.assertEqual(res,
str(webapi.ValueError(test_request, "page_len", "Argument must be 500 or less.")))
示例3: test_page_len_lt_zero_fail
# 需要導入模塊: from shiji.testutil import DummyRequest [as 別名]
# 或者: from shiji.testutil.DummyRequest import args["page_len"] [as 別名]
def test_page_len_lt_zero_fail(self):
"page_len argument in request is < 0."
test_request = DummyRequest()
test_request.args["arg1"] = ["test"]
test_request.args["page_len"] = ["-1"]
res = self.dummy_render_func2(test_request)
self.assertEqual(res,
str(webapi.ValueError(test_request, "page_len", "Argument must be 0 or greater.")))
示例4: test_page_len_invalid_int_fail
# 需要導入模塊: from shiji.testutil import DummyRequest [as 別名]
# 或者: from shiji.testutil.DummyRequest import args["page_len"] [as 別名]
def test_page_len_invalid_int_fail(self):
"page_len argument in request is not a valid integer."
test_request = DummyRequest()
test_request.args["arg1"] = ["test"]
test_request.args["page_len"] = ["xyz"]
res = self.dummy_render_func2(test_request)
self.assertEqual(res,
str(webapi.ValueError(test_request, "page_len", "Argument must be an integer.")))