本文整理匯總了Python中blog.models.Tag.find_by_id方法的典型用法代碼示例。如果您正苦於以下問題:Python Tag.find_by_id方法的具體用法?Python Tag.find_by_id怎麽用?Python Tag.find_by_id使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類blog.models.Tag
的用法示例。
在下文中一共展示了Tag.find_by_id方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_create_tag
# 需要導入模塊: from blog.models import Tag [as 別名]
# 或者: from blog.models.Tag import find_by_id [as 別名]
def test_create_tag(self, tag):
u,p,tag = tag
assert Post.find_by_id(1)
assert Tag.find_by_id(1)
assert Persion.find_by_id(1)
assert tag.posts[0] == p
assert tag.name == tag_name
assert p.name == post_name
assert p.body == post_body
assert p.author == u
assert p.author.name == persion_name
assert p.author.email == persion_email
assert p.author.password == persion_pwd
示例2: test_delete_tag
# 需要導入模塊: from blog.models import Tag [as 別名]
# 或者: from blog.models.Tag import find_by_id [as 別名]
def test_delete_tag(self, tag):
u,p,tag = tag
assert Tag.find_by_id(1)
assert Tag.find_by_id(1) == tag
tag.delete()
assert Tag.query.get(1) == None
示例3: test_retrieve_tag
# 需要導入模塊: from blog.models import Tag [as 別名]
# 或者: from blog.models.Tag import find_by_id [as 別名]
def test_retrieve_tag(self, tag):
u,p,tag = tag
assert Tag.find_by_id(1)
assert Tag.find_by_id(1) == tag
示例4: get
# 需要導入模塊: from blog.models import Tag [as 別名]
# 或者: from blog.models.Tag import find_by_id [as 別名]
def get(self, tag_id=None):
if tag_id:
return Tag.find_by_id(tag_id)
else:
return Tag.get_all()