示例#1
0
 def test_calculate_horizontal_placement_does_not_calculate_kpis_if_irrelevant_scene(
         self):
     probe_group, matches, scif = self.create_scene_scif_matches_stitch_groups_data_mocks(
         DataTestUnitPEPSICOUK.test_case_1, 3)
     scene_tb = PEPSICOUKSceneToolBox(self.data_provider_mock, self.output)
     scene_tb.calculate_shelf_placement_horizontal()
     self.assertTrue(scene_tb.kpi_results.empty)
示例#2
0
 def test_calculate_horizontal_placement(self):
     probe_group, matches, scif = self.create_scene_scif_matches_stitch_groups_data_mocks(
         DataTestUnitPEPSICOUK.test_case_1, 2)
     scene_tb = PEPSICOUKSceneToolBox(self.data_provider_mock, self.output)
     expected_list = []
     expected_list.append({
         'kpi_fk': 304,
         'numerator': 1,
         'result': 5.0 / 5 * 100
     })
     expected_list.append({
         'kpi_fk': 307,
         'numerator': 2,
         'result': round(2.0 / 6 * 100, 5)
     })
     expected_list.append({
         'kpi_fk': 306,
         'numerator': 2,
         'result': round(2.0 / 6 * 100, 5)
     })
     expected_list.append({
         'kpi_fk': 305,
         'numerator': 2,
         'result': round(2.0 / 6 * 100, 5)
     })
     expected_list.append({
         'kpi_fk': 307,
         'numerator': 3,
         'result': 1.0 * 100 / 1
     })
     scene_tb.calculate_shelf_placement_horizontal()
     kpi_results = scene_tb.kpi_results
     kpi_results['result'] = kpi_results['result'].apply(
         lambda x: round(x, 5))
     test_result_list = []
     for expected_result in expected_list:
         test_result_list.append(
             self.check_kpi_results(scene_tb.kpi_results, expected_result)
             == 1)
     self.assertTrue(all(test_result_list))