本文整理汇总了Python中flask_restful.reqparse.Argument.source方法的典型用法代码示例。如果您正苦于以下问题:Python Argument.source方法的具体用法?Python Argument.source怎么用?Python Argument.source使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类flask_restful.reqparse.Argument
的用法示例。
在下文中一共展示了Argument.source方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_source
# 需要导入模块: from flask_restful.reqparse import Argument [as 别名]
# 或者: from flask_restful.reqparse.Argument import source [as 别名]
def test_source(self):
req = Mock(['args', 'headers', 'values'])
req.args = {'foo': 'bar'}
req.headers = {'baz': 'bat'}
arg = Argument('foo', location=['args'])
self.assertEquals(arg.source(req), req.args)
arg = Argument('foo', location=['headers'])
self.assertEquals(arg.source(req), req.headers)
示例2: test_source_default_location
# 需要导入模块: from flask_restful.reqparse import Argument [as 别名]
# 或者: from flask_restful.reqparse.Argument import source [as 别名]
def test_source_default_location(self):
req = Mock(['values'])
req._get_child_mock = lambda **kwargs: NonCallableMock(**kwargs)
arg = Argument('foo')
self.assertEquals(arg.source(req), req.values)
示例3: test_source_bad_location
# 需要导入模块: from flask_restful.reqparse import Argument [as 别名]
# 或者: from flask_restful.reqparse.Argument import source [as 别名]
def test_source_bad_location(self):
req = Mock(['values'])
arg = Argument('foo', location=['foo'])
self.assertTrue(len(arg.source(req)) == 0) # yes, basically you don't find it
示例4: test_source_default_location
# 需要导入模块: from flask_restful.reqparse import Argument [as 别名]
# 或者: from flask_restful.reqparse.Argument import source [as 别名]
def test_source_default_location(self):
req = Mock(['values'])
arg = Argument('foo')
self.assertEquals(arg.source(req), req.values)
示例5: test_source_default_location
# 需要导入模块: from flask_restful.reqparse import Argument [as 别名]
# 或者: from flask_restful.reqparse.Argument import source [as 别名]
def test_source_default_location(self):
req = Mock(["values"])
req._get_child_mock = lambda **kwargs: MultiDict()
arg = Argument("foo")
self.assertEquals(arg.source(req), req.values)