本文整理汇总了Python中mamba.web.routing.Router._process方法的典型用法代码示例。如果您正苦于以下问题:Python Router._process方法的具体用法?Python Router._process怎么用?Python Router._process使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mamba.web.routing.Router
的用法示例。
在下文中一共展示了Router._process方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_process_return_objects_json_converted
# 需要导入模块: from mamba.web.routing import Router [as 别名]
# 或者: from mamba.web.routing.Router import _process [as 别名]
def test_process_return_objects_json_converted(self):
router = Router()
request = request_generator('/test')
class FakeResult(object):
name = 'Test'
type = 'JSON'
resp = router._process(FakeResult(), request)
self.assertIsInstance(resp, response.Ok)
self.assertEqual(resp.subject, {'name': 'Test', 'type': 'JSON'})
示例2: test_process_serialize_object_inside_objects
# 需要导入模块: from mamba.web.routing import Router [as 别名]
# 或者: from mamba.web.routing.Router import _process [as 别名]
def test_process_serialize_object_inside_objects(self):
import decimal
router = Router()
request = request_generator('/test')
class FakeData(object):
data = 'hdsihas8h9277t27gsj'
pepe = decimal.Decimal('10.0')
class FakeResult(object):
name = 'Test'
data = FakeData()
resp = router._process(FakeResult(), request)
self.assertIsInstance(resp, response.Ok)
self.assertEqual(resp.subject, {
'data': {'pepe': '10.0', 'data': 'hdsihas8h9277t27gsj'},
'name': 'Test'
})
示例3: test_process_return_unknown_on_none_result
# 需要导入模块: from mamba.web.routing import Router [as 别名]
# 或者: from mamba.web.routing.Router import _process [as 别名]
def test_process_return_unknown_on_none_result(self):
router = Router()
self.assertIsInstance(router._process(None, None), response.Unknown)