本文整理汇总了Python中leancloud.File.create_without_data方法的典型用法代码示例。如果您正苦于以下问题:Python File.create_without_data方法的具体用法?Python File.create_without_data怎么用?Python File.create_without_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类leancloud.File
的用法示例。
在下文中一共展示了File.create_without_data方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_fetch
# 需要导入模块: from leancloud import File [as 别名]
# 或者: from leancloud.File import create_without_data [as 别名]
def test_fetch():
r = requests.get('http://i1.wp.com/leancloud.cn/images/static/default-avatar.png')
b = buffer(r.content)
f = File('Lenna2.jpg', b)
f.metadata['foo'] = 'bar'
f.save()
fetched = File.create_without_data(f.id)
fetched.fetch()
assert fetched.id == f.id
assert fetched.metadata == f.metadata
assert fetched.name == f.name
assert fetched.url == f.url
assert fetched.size == f.size
assert fetched.url == f.url
f.destroy()
示例2: test_fetch
# 需要导入模块: from leancloud import File [as 别名]
# 或者: from leancloud.File import create_without_data [as 别名]
def test_fetch(): # type: () -> None
r = requests.get('http://i1.wp.com/leancloud.cn/images/static/default-avatar.png')
b = io.BytesIO(r.content)
f = File('Lenna2.jpg', b)
f.metadata['foo'] = 'bar'
f.save()
fetched = File.create_without_data(f.id)
fetched.fetch()
normalized_f_url = f.url.split('/')[-1]
normalized_fetched_url = f.url.split('/')[-1]
assert fetched.id == f.id
assert fetched.metadata == f.metadata
assert fetched.name == f.name
assert fetched.size == f.size
assert fetched.url == f.url or normalized_fetched_url == normalized_f_url
f.destroy()
示例3: test_create_without_data
# 需要导入模块: from leancloud import File [as 别名]
# 或者: from leancloud.File import create_without_data [as 别名]
def test_create_without_data():
f = File.create_without_data(123)
assert f.id == 123
示例4: test_create_without_data
# 需要导入模块: from leancloud import File [as 别名]
# 或者: from leancloud.File import create_without_data [as 别名]
def test_create_without_data(): # type: () -> None
f = File.create_without_data('a123')
assert f.id == 'a123'