本文整理汇总了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")