def test_invalid_field_type(self): paragraphs = self.get_paragraphs(two_fp_with_invalid_field) rule = FieldType(paragraphs) self.assertFalse(rule.apply()) self.assertEqual(len(rule.messages), 1) msg = rule.messages[0] self.assertEqual(msg.line_number, 6) self.assertEqual(msg.position, 1) self.assertEqual(msg.txt, "Invalid Field")
def test_invalid_single_line_value(self): paragraphs = self.get_paragraphs(invalid_single_line_values) rule = FieldType(paragraphs) self.assertFalse(rule.apply()) self.assertEqual(len(rule.messages), 1) msg = rule.messages[0] self.assertEqual(msg.line_number, 2) self.assertEqual(msg.position, 73) self.assertEqual(msg.txt, "This field doesn't allow multiples lines")