def setUp(self):
     """
     Sets up the following test cases
     """
     self.csv_lines = [
         'LIST,ARTIFACT,NEGATION,RELATION,ITEM',
         'BLE,Member,,Contains,Something',
         'BLE,Member,,Contains,PartA,Member,Not,Contains,PartB'
     ]
     self.csv_str = '\n'.join(self.csv_lines)
     # Mock the context managed open statement to return the test CSV
     # mock open specifically in the target module
     open_name = '{0}.open'.format(neg_num.__name__)
     with mock.patch(open_name, create=True) as m:
         m.return_value = io.StringIO(self.csv_str)
         self.blacklist_exclusion_rules = neg_num.get_rules_from_csv(
             dqc_us_0015._DEFAULT_EXCLUSIONS_FILE
         )
     self.rule_one = neg_num._parse_row(
         self.csv_lines[0].split(',')[1:]
     )
     self.rule_two = neg_num._parse_row(
         self.csv_lines[1].split(',')[1:]
     )
     self.rule_three = neg_num._parse_row(
         self.csv_lines[2].split(',')[1:]
     )
 def test_actual_rule_config(self):
     """
     Verifies the actual exclusion rule config can be parsed with no
     exceptions and has only expected values
     """
     with open(dqc_us_0015._DEFAULT_EXCLUSIONS_FILE, 'rt') as f:
         rule_line_count = len(f.readlines()) - 1  # remember the header
     blacklist_exclusion_rules = neg_num.get_rules_from_csv(
         dqc_us_0015._DEFAULT_EXCLUSIONS_FILE)
     # If any values are not BLE , they will not get returned and this
     # count will be less than # of lines.
     total_rule_count = len(blacklist_exclusion_rules)
     self.assertEqual(
         rule_line_count, total_rule_count,
         "{} lines resulted in {} rules".format(rule_line_count,
                                                total_rule_count))
 def test_actual_rule_config(self):
     """
     Verifies the actual exclusion rule config can be parsed with no
     exceptions and has only expected values
     """
     with open(dqc_us_0015._DEFAULT_EXCLUSIONS_FILE, 'rt') as f:
         rule_line_count = len(f.readlines()) - 1  # remember the header
     blacklist_exclusion_rules = neg_num.get_rules_from_csv(
         dqc_us_0015._DEFAULT_EXCLUSIONS_FILE
     )
     # If any values are not BLE , they will not get returned and this
     # count will be less than # of lines.
     total_rule_count = len(blacklist_exclusion_rules)
     self.assertEqual(
         rule_line_count, total_rule_count,
         "{} lines resulted in {} rules".format(
             rule_line_count, total_rule_count
         )
     )
 def setUp(self):
     """
     Sets up the following test cases
     """
     self.csv_lines = [
         'LIST,ARTIFACT,NEGATION,RELATION,ITEM',
         'BLE,Member,,Contains,Something',
         'BLE,Member,,Contains,PartA,Member,Not,Contains,PartB'
     ]
     self.csv_str = '\n'.join(self.csv_lines)
     # Mock the context managed open statement to return the test CSV
     # mock open specifically in the target module
     open_name = '{0}.open'.format(neg_num.__name__)
     with mock.patch(open_name, create=True) as m:
         m.return_value = io.StringIO(self.csv_str)
         self.blacklist_exclusion_rules = neg_num.get_rules_from_csv(
             dqc_us_0015._DEFAULT_EXCLUSIONS_FILE)
     self.rule_one = neg_num._parse_row(self.csv_lines[0].split(',')[1:])
     self.rule_two = neg_num._parse_row(self.csv_lines[1].split(',')[1:])
     self.rule_three = neg_num._parse_row(self.csv_lines[2].split(',')[1:])