本文整理匯總了Python中wikipendium.wiki.models.Article.slug方法的典型用法代碼示例。如果您正苦於以下問題:Python Article.slug方法的具體用法?Python Article.slug怎麽用?Python Article.slug使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類wikipendium.wiki.models.Article
的用法示例。
在下文中一共展示了Article.slug方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_slug_cannot_contain_slashes
# 需要導入模塊: from wikipendium.wiki.models import Article [as 別名]
# 或者: from wikipendium.wiki.models.Article import slug [as 別名]
def test_slug_cannot_contain_slashes(self):
article = Article()
article.slug = u'TDT/4100'
try:
article.save()
self.assertEqual(1, 2) # this should not be reached
except ValidationError:
self.assertEqual(1, 1) # correct error was raised
示例2: test_slug_should_uppercase_when_saved
# 需要導入模塊: from wikipendium.wiki.models import Article [as 別名]
# 或者: from wikipendium.wiki.models.Article import slug [as 別名]
def test_slug_should_uppercase_when_saved(self):
article = Article()
article.slug = u'lowercase'
article.save()
self.assertEqual(article.slug, u'LOWERCASE')
示例3: test_slug_should_strip_whitespace_when_saved
# 需要導入模塊: from wikipendium.wiki.models import Article [as 別名]
# 或者: from wikipendium.wiki.models.Article import slug [as 別名]
def test_slug_should_strip_whitespace_when_saved(self):
article = Article()
article.slug = u' PADDED\v\t \n'
article.save()
self.assertEqual(article.slug, u'PADDED')
示例4: test_slug_should_uppercase_when_saved
# 需要導入模塊: from wikipendium.wiki.models import Article [as 別名]
# 或者: from wikipendium.wiki.models.Article import slug [as 別名]
def test_slug_should_uppercase_when_saved(self):
article = Article()
article.slug = "lowercase"
article.save()
self.assertEqual(article.slug, "LOWERCASE")