本文整理汇总了Python中validator.Validator.validateTitlePlacement方法的典型用法代码示例。如果您正苦于以下问题:Python Validator.validateTitlePlacement方法的具体用法?Python Validator.validateTitlePlacement怎么用?Python Validator.validateTitlePlacement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类validator.Validator
的用法示例。
在下文中一共展示了Validator.validateTitlePlacement方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testPoorlyPlacedTitle
# 需要导入模块: from validator import Validator [as 别名]
# 或者: from validator.Validator import validateTitlePlacement [as 别名]
def testPoorlyPlacedTitle(self):
with open('buffer.txt', 'w', encoding='utf-8') as self.buffer:
self.buffer.write('\n\n\t\t\t\t<div></div><h1>Person v. Person - 100 U.S. 25 (2000)</h1>')
v = Validator('buffer.txt')
with self.assertRaises(BadTitle, msg='Validator passed a title that was not at the '
'beginning of the file.'):
v.validateTitlePlacement()
示例2: testGoodTitlePlacement
# 需要导入模块: from validator import Validator [as 别名]
# 或者: from validator.Validator import validateTitlePlacement [as 别名]
def testGoodTitlePlacement(self):
with open('buffer.txt', 'w', encoding='utf-8') as self.buffer:
self.buffer.write('\n\n\t\t\t\t<h1>Person v. Person - 100 U.S. 25 (2000)</h1>')
v = Validator('buffer.txt')
try:
v.validateTitlePlacement()
except:
self.fail('Validator did not pass a good title.')
示例3: testNoTitle
# 需要导入模块: from validator import Validator [as 别名]
# 或者: from validator.Validator import validateTitlePlacement [as 别名]
def testNoTitle(self):
with open('buffer.txt', 'w', encoding='utf-8') as self.buffer:
self.buffer.write('\n\n\t\t\t')
v = Validator('buffer.txt')
with self.assertRaises(BadTitle, msg='Validator passed a file with no title.'):
v.validateTitlePlacement()