当前位置: 首页>>代码示例>>Python>>正文


Python Schema.bundle方法代码示例

本文整理汇总了Python中txaws.server.schema.Schema.bundle方法的典型用法代码示例。如果您正苦于以下问题:Python Schema.bundle方法的具体用法?Python Schema.bundle怎么用?Python Schema.bundle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在txaws.server.schema.Schema的用法示例。


在下文中一共展示了Schema.bundle方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_bundle_with_numbered_not_supplied

# 需要导入模块: from txaws.server.schema import Schema [as 别名]
# 或者: from txaws.server.schema.Schema import bundle [as 别名]
 def test_bundle_with_numbered_not_supplied(self):
     """
     L{Schema.bundle} ignores parameters that are not present.
     """
     schema = Schema(Unicode("name.n"))
     params = schema.bundle()
     self.assertEqual({}, params)
开发者ID:antisvin,项目名称:txAWS,代码行数:9,代码来源:test_schema.py

示例2: test_bundle_with_empty_numbered

# 需要导入模块: from txaws.server.schema import Schema [as 别名]
# 或者: from txaws.server.schema.Schema import bundle [as 别名]
 def test_bundle_with_empty_numbered(self):
     """
     L{Schema.bundle} correctly handles an empty numbered arguments list.
     """
     schema = Schema(Unicode("name.n"))
     params = schema.bundle(name=[])
     self.assertEqual({}, params)
开发者ID:antisvin,项目名称:txAWS,代码行数:9,代码来源:test_schema.py

示例3: test_bundle_with_numbered

# 需要导入模块: from txaws.server.schema import Schema [as 别名]
# 或者: from txaws.server.schema.Schema import bundle [as 别名]
 def test_bundle_with_numbered(self):
     """
     L{Schema.bundle} correctly handles numbered arguments.
     """
     schema = Schema(Unicode("name.n"))
     params = schema.bundle(name=["foo", "bar"])
     self.assertEqual({"name.1": "foo", "name.2": "bar"}, params)
开发者ID:antisvin,项目名称:txAWS,代码行数:9,代码来源:test_schema.py

示例4: test_bundle_with_arguments

# 需要导入模块: from txaws.server.schema import Schema [as 别名]
# 或者: from txaws.server.schema.Schema import bundle [as 别名]
 def test_bundle_with_arguments(self):
     """L{Schema.bundle} can bundle L{Arguments} too."""
     schema = Schema(Unicode("name.n"), Integer("count"))
     arguments = Arguments({"name": Arguments({1: "Foo", 7: "Bar"}),
                            "count": 123})
     params = schema.bundle(arguments)
     self.assertEqual({"name.1": "Foo", "name.7": "Bar", "count": "123"},
                      params)
开发者ID:antisvin,项目名称:txAWS,代码行数:10,代码来源:test_schema.py

示例5: test_bundle_with_multiple

# 需要导入模块: from txaws.server.schema import Schema [as 别名]
# 或者: from txaws.server.schema.Schema import bundle [as 别名]
 def test_bundle_with_multiple(self):
     """
     L{Schema.bundle} correctly handles multiple arguments.
     """
     schema = Schema(Unicode("name.n"), Integer("count"))
     params = schema.bundle(name=["Foo", "Bar"], count=123)
     self.assertEqual({"name.1": "Foo", "name.2": "Bar", "count": "123"},
                      params)
开发者ID:antisvin,项目名称:txAWS,代码行数:10,代码来源:test_schema.py

示例6: test_bundle

# 需要导入模块: from txaws.server.schema import Schema [as 别名]
# 或者: from txaws.server.schema.Schema import bundle [as 别名]
 def test_bundle(self):
     """
     L{Schema.bundle} returns a dictionary of raw parameters that
     can be used for an EC2-style query.
     """
     schema = Schema(Unicode("name"))
     params = schema.bundle(name="foo")
     self.assertEqual({"name": "foo"}, params)
开发者ID:antisvin,项目名称:txAWS,代码行数:10,代码来源:test_schema.py

示例7: test_bundle_with_structure

# 需要导入模块: from txaws.server.schema import Schema [as 别名]
# 或者: from txaws.server.schema.Schema import bundle [as 别名]
 def test_bundle_with_structure(self):
     """L{Schema.bundle} can bundle L{Structure}s."""
     schema = Schema(
         parameters=[
             Structure("struct", fields={"field1": Unicode(),
                                         "field2": Integer()})])
     params = schema.bundle(struct={"field1": "hi", "field2": 59})
     self.assertEqual({"struct.field1": "hi", "struct.field2": "59"},
                      params)
开发者ID:antisvin,项目名称:txAWS,代码行数:11,代码来源:test_schema.py

示例8: test_bundle_with_two_numbered

# 需要导入模块: from txaws.server.schema import Schema [as 别名]
# 或者: from txaws.server.schema.Schema import bundle [as 别名]
 def test_bundle_with_two_numbered(self):
     """
     L{Schema.bundle} can bundle multiple numbered lists.
     """
     schema = Schema(Unicode("names.n"), Unicode("things.n"))
     params = schema.bundle(names=["foo", "bar"], things=["baz", "quux"])
     self.assertEqual({"names.1": "foo", "names.2": "bar",
                       "things.1": "baz", "things.2": "quux"},
                      params)
开发者ID:antisvin,项目名称:txAWS,代码行数:11,代码来源:test_schema.py

示例9: test_bundle_with_arguments_and_extra

# 需要导入模块: from txaws.server.schema import Schema [as 别名]
# 或者: from txaws.server.schema.Schema import bundle [as 别名]
    def test_bundle_with_arguments_and_extra(self):
        """
        L{Schema.bundle} can bundle L{Arguments} with keyword arguments too.

        Keyword arguments take precedence.
        """
        schema = Schema(Unicode("name.n"), Integer("count"))
        arguments = Arguments({"name": {1: "Foo", 7: "Bar"}, "count": 321})
        params = schema.bundle(arguments, count=123)
        self.assertEqual({"name.1": "Foo", "name.2": "Bar", "count": "123"},
                         params)
开发者ID:antisvin,项目名称:txAWS,代码行数:13,代码来源:test_schema.py

示例10: test_bundle_with_list_with_arguments

# 需要导入模块: from txaws.server.schema import Schema [as 别名]
# 或者: from txaws.server.schema.Schema import bundle [as 别名]
 def test_bundle_with_list_with_arguments(self):
     """L{Schema.bundle} can bundle L{List}s (specified as L{Arguments})."""
     schema = Schema(parameters=[List("things", item=Unicode())])
     params = schema.bundle(things=Arguments({1: "foo", 2: "bar"}))
     self.assertEqual({"things.1": "foo", "things.2": "bar"}, params)
开发者ID:antisvin,项目名称:txAWS,代码行数:7,代码来源:test_schema.py

示例11: test_bundle_with_list

# 需要导入模块: from txaws.server.schema import Schema [as 别名]
# 或者: from txaws.server.schema.Schema import bundle [as 别名]
 def test_bundle_with_list(self):
     """L{Schema.bundle} can bundle L{List}s."""
     schema = Schema(parameters=[List("things", item=Unicode())])
     params = schema.bundle(things=["foo", "bar"])
     self.assertEqual({"things.1": "foo", "things.2": "bar"}, params)
开发者ID:antisvin,项目名称:txAWS,代码行数:7,代码来源:test_schema.py

示例12: test_bundle_with_none

# 需要导入模块: from txaws.server.schema import Schema [as 别名]
# 或者: from txaws.server.schema.Schema import bundle [as 别名]
 def test_bundle_with_none(self):
     """L{None} values are discarded in L{Schema.bundle}."""
     schema = Schema(Unicode("name.n", optional=True))
     params = schema.bundle(name=None)
     self.assertEqual({}, params)
开发者ID:antisvin,项目名称:txAWS,代码行数:7,代码来源:test_schema.py


注:本文中的txaws.server.schema.Schema.bundle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。