Ejemplo n.º 1
0
    def test_that_converter_methods_work(self):
        # Arrange
        state = StateReductionMode()

        state.reduction_mode = ReductionMode.MERGED
        state.dimensionality = ReductionDimensionality.TWO_DIM
        state.merge_shift = 12.65
        state.merge_scale = 34.6
        state.merge_fit_mode = FitModeForMerge.SHIFT_ONLY

        state.detector_names[DetectorType.LAB.value] = "Test1"
        state.detector_names[DetectorType.HAB.value] = "Test2"

        state.merge_mask = True
        state.merge_min = 78.89
        state.merge_max = 56.4

        # Assert
        merge_strategy = state.get_merge_strategy()
        self.assertEqual(merge_strategy[0], ReductionMode.LAB)
        self.assertEqual(merge_strategy[1], ReductionMode.HAB)

        all_reductions = state.get_all_reduction_modes()
        self.assertEqual(len(all_reductions),  2)
        self.assertEqual(all_reductions[0], ReductionMode.LAB)
        self.assertEqual(all_reductions[1], ReductionMode.HAB)

        result_lab = state.get_detector_name_for_reduction_mode(ReductionMode.LAB)
        self.assertEqual(result_lab,  "Test1")
        result_hab = state.get_detector_name_for_reduction_mode(ReductionMode.HAB)
        self.assertEqual(result_hab,  "Test2")

        self.assertRaises(RuntimeError, state.get_detector_name_for_reduction_mode, "non_sense")
Ejemplo n.º 2
0
    def test_that_converter_methods_work(self):
        # Arrange
        state = StateReductionMode()

        state.reduction_mode = ReductionMode.MERGED
        state.dimensionality = ReductionDimensionality.TWO_DIM
        state.merge_shift = 12.65
        state.merge_scale = 34.6
        state.merge_fit_mode = FitModeForMerge.SHIFT_ONLY

        state.merge_mask = True
        state.merge_min = 78.89
        state.merge_max = 56.4

        # Assert
        merge_strategy = state.get_merge_strategy()
        self.assertEqual(merge_strategy[0], ReductionMode.LAB)
        self.assertEqual(merge_strategy[1], ReductionMode.HAB)

        all_reductions = state.get_all_reduction_modes()
        self.assertEqual(len(all_reductions), 2)
        self.assertEqual(all_reductions[0], ReductionMode.LAB)
        self.assertEqual(all_reductions[1], ReductionMode.HAB)