本文整理汇总了Python中shiji.testutil.DummyRequest.args["page"]方法的典型用法代码示例。如果您正苦于以下问题:Python DummyRequest.args["page"]方法的具体用法?Python DummyRequest.args["page"]怎么用?Python DummyRequest.args["page"]使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类shiji.testutil.DummyRequest
的用法示例。
在下文中一共展示了DummyRequest.args["page"]方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_good_page_overrides_default
# 需要导入模块: from shiji.testutil import DummyRequest [as 别名]
# 或者: from shiji.testutil.DummyRequest import args["page"] [as 别名]
def test_good_page_overrides_default(self):
"Valid page argument overrides page from default."
test_request = DummyRequest()
test_request.args["arg1"] = ["test"]
test_request.args["page"] = ["1"]
res = self.dummy_render_func2(test_request)
self.assertEqual(res["page"][0], "1")
示例2: test_page_lt_zero_fail
# 需要导入模块: from shiji.testutil import DummyRequest [as 别名]
# 或者: from shiji.testutil.DummyRequest import args["page"] [as 别名]
def test_page_lt_zero_fail(self):
"page argument in request is < 0."
test_request = DummyRequest()
test_request.args["arg1"] = ["test"]
test_request.args["page"] = ["-1"]
res = self.dummy_render_func2(test_request)
self.assertEqual(res,
str(webapi.ValueError(test_request, "page", "Argument must be 0 or greater.")))
示例3: test_page_invalid_int_fail
# 需要导入模块: from shiji.testutil import DummyRequest [as 别名]
# 或者: from shiji.testutil.DummyRequest import args["page"] [as 别名]
def test_page_invalid_int_fail(self):
"page argument in request is not a valid integer."
test_request = DummyRequest()
test_request.args["arg1"] = ["test"]
test_request.args["page"] = ["xyz"]
res = self.dummy_render_func2(test_request)
self.assertEqual(res,
str(webapi.ValueError(test_request, "page", "Argument must be an integer.")))
示例4: test_good_page_and_page_len_overrides_default
# 需要导入模块: from shiji.testutil import DummyRequest [as 别名]
# 或者: from shiji.testutil.DummyRequest import args["page"] [as 别名]
def test_good_page_and_page_len_overrides_default(self):
"Valid page & page_len arguments override page & page_len from defaults."
test_request = DummyRequest()
test_request.args["arg1"] = ["test"]
test_request.args["page"] = ["1"]
test_request.args["page_len"] = ["50"]
res = self.dummy_render_func2(test_request)
self.assertEqual(res["page"][0], "1")
self.assertEqual(res["page_len"][0], "50")