Ejemplo n.º 1
0
 def test_set_filtered_scif_and_matches_for_specific_kpi_additionally_filter_scif_and_matches(
         self):
     self.mock_scene_item_facts(
         pd.read_excel(DataTestUnitPEPSICOUK.test_case_rollout,
                       sheetname='scif'))
     self.mock_match_product_in_scene(
         pd.read_excel(DataTestUnitPEPSICOUK.test_case_rollout,
                       sheetname='matches'))
     self.mock_store_area(DataTestUnitPEPSICOUK.store_area_map_neutral)
     tool_box = PEPSICOUKCommonToolBox(self.data_provider_mock, self.output)
     scif, matches = tool_box.set_filtered_scif_and_matches_for_specific_kpi(
         tool_box.filtered_scif, tool_box.filtered_matches, 'Brand SOS')
     matches_excluded_kpi_specific = set(tool_box.filtered_matches['probe_match_fk'].values.tolist()) - \
                                         set(matches['probe_match_fk'].values.tolist())
     self.assertEquals(len(matches), 30)
     self.assertNotEqual(len(matches), len(tool_box.filtered_matches))
     included_matches_expected = [
         3, 4, 5, 6, 7, 8, 14, 15, 17, 18, 19, 21, 22, 23, 24, 25, 26, 27,
         28, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43
     ]
     excluded_matches_expected = [
         11, 12, 13, 20, 29, 30, 31, 32, 44, 45, 46, 47, 48, 49, 50, 51
     ]
     self.assertItemsEqual(matches_excluded_kpi_specific,
                           excluded_matches_expected)
     matches_positive_check = tool_box.filtered_matches[tool_box.filtered_matches['probe_match_fk']. \
         isin(included_matches_expected)]
     self.assertItemsEqual(
         included_matches_expected,
         matches_positive_check['probe_match_fk'].values.tolist())
     self.assertEquals(len(scif), 5)
     self.assertNotEqual(len(scif), len(tool_box.filtered_scif))
Ejemplo n.º 2
0
 def test_set_filtered_scif_and_matches_for_specific_kpi_does_not_change_filtered_scif_and_matches_if_no_policy_applies(
         self):
     self.mock_scene_item_facts(
         pd.read_excel(DataTestUnitPEPSICOUK.test_case_1, sheetname='scif'))
     self.mock_match_product_in_scene(
         pd.read_excel(DataTestUnitPEPSICOUK.test_case_1,
                       sheetname='matches'))
     self.mock_store_area(DataTestUnitPEPSICOUK.store_area_map_neutral)
     tool_box = PEPSICOUKCommonToolBox(self.data_provider_mock, self.output)
     scif, matches = tool_box.set_filtered_scif_and_matches_for_specific_kpi(
         tool_box.filtered_scif, tool_box.filtered_matches,
         'PepsiCo Segment Space to Sales Index')
     self.assertEquals(len(matches), len(tool_box.filtered_matches))
     self.assertEquals(len(scif), len(tool_box.filtered_scif))
     assert_frame_equal(scif, tool_box.filtered_scif)
     assert_frame_equal(matches, tool_box.filtered_matches)