本文整理汇总了Python中boto.s3.bucket.Bucket._get_all_query_args方法的典型用法代码示例。如果您正苦于以下问题:Python Bucket._get_all_query_args方法的具体用法?Python Bucket._get_all_query_args怎么用?Python Bucket._get_all_query_args使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boto.s3.bucket.Bucket
的用法示例。
在下文中一共展示了Bucket._get_all_query_args方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test__get_all_query_args
# 需要导入模块: from boto.s3.bucket import Bucket [as 别名]
# 或者: from boto.s3.bucket.Bucket import _get_all_query_args [as 别名]
def test__get_all_query_args(self):
bukket = Bucket()
# Default.
qa = bukket._get_all_query_args({})
self.assertEqual(qa, '')
# Default with initial.
qa = bukket._get_all_query_args({}, 'initial=1')
self.assertEqual(qa, 'initial=1')
# Single param.
qa = bukket._get_all_query_args({
'foo': 'true'
})
self.assertEqual(qa, 'foo=true')
# Single param with initial.
qa = bukket._get_all_query_args({
'foo': 'true'
}, 'initial=1')
self.assertEqual(qa, 'initial=1&foo=true')
# Multiple params with all the weird cases.
multiple_params = {
'foo': 'true',
# Ensure Unicode chars get encoded.
'bar': '☃',
# Ensure unicode strings with non-ascii characters get encoded
'baz': u'χ',
# Underscores are bad, m'kay?
'some_other': 'thing',
# Change the variant of ``max-keys``.
'maxkeys': 0,
# ``None`` values get excluded.
'notthere': None,
# Empty values also get excluded.
'notpresenteither': '',
}
qa = bukket._get_all_query_args(multiple_params)
self.assertEqual(
qa,
'bar=%E2%98%83&baz=%CF%87&foo=true&max-keys=0&some-other=thing'
)
# Multiple params with initial.
qa = bukket._get_all_query_args(multiple_params, 'initial=1')
self.assertEqual(
qa,
'initial=1&bar=%E2%98%83&baz=%CF%87&foo=true&max-keys=0&some-other=thing'
)
示例2: test__get_all_query_args
# 需要导入模块: from boto.s3.bucket import Bucket [as 别名]
# 或者: from boto.s3.bucket.Bucket import _get_all_query_args [as 别名]
def test__get_all_query_args(self):
bukket = Bucket()
# Default.
qa = bukket._get_all_query_args({})
self.assertEqual(qa, "")
# Default with initial.
qa = bukket._get_all_query_args({}, "initial=1")
self.assertEqual(qa, "initial=1")
# Single param.
qa = bukket._get_all_query_args({"foo": "true"})
self.assertEqual(qa, "foo=true")
# Single param with initial.
qa = bukket._get_all_query_args({"foo": "true"}, "initial=1")
self.assertEqual(qa, "initial=1&foo=true")
# Multiple params with all the weird cases.
multiple_params = {
"foo": "true",
# Ensure Unicode chars get encoded.
"bar": "☃",
# Underscores are bad, m'kay?
"some_other": "thing",
# Change the variant of ``max-keys``.
"maxkeys": 0,
# ``None`` values get excluded.
"notthere": None,
# Empty values also get excluded.
"notpresenteither": "",
}
qa = bukket._get_all_query_args(multiple_params)
self.assertEqual(qa, "bar=%E2%98%83&max-keys=0&foo=true&some-other=thing")
# Multiple params with initial.
qa = bukket._get_all_query_args(multiple_params, "initial=1")
self.assertEqual(qa, "initial=1&bar=%E2%98%83&max-keys=0&foo=true&some-other=thing")