示例#1
0
 def test_validate_blank_if_other_in_list_case_insensitive_invalid(self):
     sheet = OPWorkbook(self.empty_if_workbook,
                        self.empty_if_config).description
     sheet.validate_blank('empty_if_field_4_is_cat_invalid')
     self.assertEqual(len(sheet.errors), 1)
     self.assertRegexpMatches(sheet.errors[0],
                              r'.* must be empty if.*is.*cat.*; found:')
示例#2
0
 def test_validate_blank_if_other_empty_invalid(self):
     sheet = OPWorkbook(self.empty_if_workbook,
                        self.empty_if_config).description
     sheet.validate_blank('empty_if_field_1_empty_invalid')
     self.assertEqual(len(sheet.errors), 1)
     self.assertRegexpMatches(sheet.errors[0],
                              r'.* must be empty if.*is empty; found.*')
示例#3
0
 def test_empty_if_other_nonempty(self):
     sheet = OPWorkbook(self.pages_invalid_workbook,
                        self.pages_config).pages
     sheet.validate_blank('serial_num')
     self.assertEqual(len(sheet.errors), 1)
     self.assertRegexpMatches(sheet.errors[0],
                              r"'SERIAL_NUM' must be empty.* 'FILE_NAME'")
示例#4
0
 def test_value4_blank_if_toc4_empty(self):
     sheet = OPWorkbook(self.pages_invalid_workbook,
                        self.pages_config).pages
     sheet.validate_blank('value4')
     self.assertEqual(len(sheet.errors), 1)
     self.assertRegexpMatches(sheet.errors[0],
                              r"'VALUE4' must be empty.* 'TAG4'.*'Car'")
示例#5
0
 def test_value3_blank_if_toc3_empty(self):
     sheet = OPWorkbook(self.pages_invalid_workbook,
                        self.pages_config).pages
     sheet.validate_blank('value3')
     self.assertEqual(len(sheet.errors), 1)
     self.assertRegexpMatches(
         sheet.errors[0], r"'VALUE3' must be empty.* 'TAG3'.*'March 15'")
示例#6
0
 def test_validate_blank_if_other_in_list_repeating(self):
     sheet = OPWorkbook(self.empty_if_workbook,
                        self.empty_if_config).description
     sheet.validate_blank('empty_if_5_is_cat')
     self.assertEqual(len(sheet.errors), 1)
     self.assertRegexpMatches(
         sheet.errors[0],
         r'.* must be empty if.*is.*CAT.*; found:.*value 2.*')
示例#7
0
 def test_value2_blank_if_toc2_empty(self):
     sheet = OPWorkbook(self.pages_invalid_workbook,
                        self.pages_config).pages
     sheet.validate_blank('value2')
     self.assertEqual(len(sheet.errors), 1)
     self.assertRegexpMatches(
         sheet.errors[0],
         r"'VALUE2' must be empty.* 'TAG2'.*'September 27'")
示例#8
0
 def test_validate_blank_if_other_nonempty_invalid(self):
     sheet = OPWorkbook(self.empty_if_workbook,
                        self.empty_if_config).description
     sheet.validate_blank(
         'empty_if_field_2_nonempty_first_and_third_present')
     self.assertEqual(len(sheet.errors), 2)
     self.assertRegexpMatches(sheet.errors[0],
                              r'.* must be empty if.*has a value; found')
     self.assertRegexpMatches(sheet.errors[1],
                              r'.* must be empty if.*has a value; found')
示例#9
0
 def test_validate_blank_if_other_in_list_valid(self):
     sheet = OPWorkbook(self.empty_if_workbook,
                        self.empty_if_config).description
     sheet.validate_blank('empty_if_3_is_cat_valid')
     self.assertEqual(len(sheet.errors), 0)