本文整理汇总了Python中validator.Validator.validateTitleParts方法的典型用法代码示例。如果您正苦于以下问题:Python Validator.validateTitleParts方法的具体用法?Python Validator.validateTitleParts怎么用?Python Validator.validateTitleParts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类validator.Validator
的用法示例。
在下文中一共展示了Validator.validateTitleParts方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testIdentifyCaseGroup
# 需要导入模块: from validator import Validator [as 别名]
# 或者: from validator.Validator import validateTitleParts [as 别名]
def testIdentifyCaseGroup(self):
with open('buffer.txt', 'w', encoding='utf-8') as self.buffer:
self.buffer.write('\t\t\t<h1>Group of Cases - 100 U.S. 200 (2013)</h1>\t\t\t')
v = Validator('buffer.txt')
with self.assertRaises(GroupedCase, msg='Validator failed to identify a group of cases'
' as such.'):
v.validateTitleParts()
示例2: testBadTitleNumber
# 需要导入模块: from validator import Validator [as 别名]
# 或者: from validator.Validator import validateTitleParts [as 别名]
def testBadTitleNumber(self):
with open('buffer.txt', 'w', encoding='utf-8') as self.buffer:
self.buffer.write('<h1>Foo v. Bar - U.S. 200 (2013)</h1>')
v = Validator('buffer.txt')
with self.assertRaises(BadTitle, msg='Validator passed a title containing an improperly'
'formatted case number.'):
v.validateTitleParts()
示例3: testGoodTitleParts
# 需要导入模块: from validator import Validator [as 别名]
# 或者: from validator.Validator import validateTitleParts [as 别名]
def testGoodTitleParts(self):
with open('buffer.txt', 'w', encoding='utf-8') as self.buffer:
self.buffer.write('\t\t\t\t<h1>Foo v. Bar - 100 U.S. 200 (2013)</h1><div>Extra stuff</div>')
v = Validator('buffer.txt')
try:
v.validateTitleParts()
except:
self.fail('Validator did not pass a title with good parts.')