本文整理汇总了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.")))