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()
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()
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.')