def test_test(self): self.assertFalse(IntOctWithPhoneDatePostalCode.test( [], ['Number', 'Integer', 'Octal'] )) self.assertTrue(IntOctWithPhoneDatePostalCode.test( [], ['Integer', 'Octal', 'Date'] ))
def test_normalize(self): results = [ ParseResult('Number', 'Integer', 100), ParseResult('Number', 'Octal', 25), ParseResult('Date', 'Date', 50) ] results = IntOctWithPhoneDatePostalCode.normalize(results) count = 0 for res in results: count += 1 if res.subtype == 'Integer': self.assertEqual(10, res.confidence) elif res.subtype == 'Octal': self.assertEqual(5, res.confidence) else: self.assertEqual(50, res.confidence) self.assertEqual(count, 3)