Example #1
0
 def assert_raises_for_bad_value_and_raises_nothing_for_good_value(
         self, entry_name, bad_value, good_value):
     kwargs = {entry_name: bad_value}
     state = self._get_normalize_to_monitor_state(**kwargs)
     assert_validate_error(self, ValueError, state)
     setattr(state, entry_name, good_value)
     assert_raises_nothing(self, state)
Example #2
0
 def test_that_raises_when_lower_wavelength_is_smaller_than_high_wavelength(self):
     state = StateWavelengthAndPixelAdjustment()
     state.wavelength_low = 2.
     state.wavelength_high = 1.
     state.wavelength_step = 2.
     state.wavelength_step_type = RangeStepType.Lin
     assert_validate_error(self, ValueError, state)
Example #3
0
    def assert_raises_for_bad_value_and_raises_nothing_for_good_value(
            self,
            entry_name=None,
            bad_value_general=None,
            bad_value_detector=None,
            good_value_general=None,
            good_value_detector=None):
        # Bad values
        bad_value_general_dict = StateMaskTest._get_dict(
            entry_name, bad_value_general)
        bad_value_detector_dict = StateMaskTest._get_dict(
            entry_name, bad_value_detector)

        state = self._get_mask_state(bad_value_general_dict,
                                     bad_value_detector_dict)
        assert_validate_error(self, ValueError, state)

        # Good values
        good_value_general_dict = StateMaskTest._get_dict(
            entry_name, good_value_general)
        good_value_detector_dict = StateMaskTest._get_dict(
            entry_name, good_value_detector)
        state = self._get_mask_state(good_value_general_dict,
                                     good_value_detector_dict)
        assert_raises_nothing(self, state)
Example #4
0
 def test_that_raises_when_lower_wavelength_is_smaller_than_high_wavelength(
         self):
     state = StateWavelength()
     state.wavelength_low = 2.
     state.wavelength_high = 1.
     state.wavelength_step = 2.
     assert_validate_error(self, ValueError, state)
Example #5
0
 def test_that_raises_if_the_short_detector_name_is_not_set_up(self):
     state = StateMove()
     state.detectors[DetectorType.to_string(DetectorType.HAB)].detector_name = "test"
     state.detectors[DetectorType.to_string(DetectorType.LAB)].detector_name = "test"
     state.detectors[DetectorType.to_string(DetectorType.HAB)].detector_name_short = "test"
     assert_validate_error(self, ValueError, state)
     state.detectors[DetectorType.to_string(DetectorType.LAB)].detector_name_short = "test"
     assert_raises_nothing(self, state)
Example #6
0
    def check_bad_and_good_values(self, bad_state, good_state):
        # Bad values
        state = self._get_state(bad_state)
        assert_validate_error(self, ValueError, state)

        # Good values
        state = self._get_state(good_state)
        assert_raises_nothing(self, state)
    def check_bad_and_good_value(self, bad_convert_to_q, good_convert_to_q):
        # Bad values
        state = self._get_convert_to_q_state(bad_convert_to_q)
        assert_validate_error(self, ValueError, state)

        # Good values
        state = self._get_convert_to_q_state(good_convert_to_q)
        assert_raises_nothing(self, state)
    def check_bad_and_good_values(self, bad_trans=None, bad_fit=None, good_trans=None, good_fit=None):
        # Bad values
        state = self._get_calculate_transmission_state(bad_trans, bad_fit)
        assert_validate_error(self, ValueError, state)

        # Good values
        state = self._get_calculate_transmission_state(good_trans, good_fit)
        assert_raises_nothing(self, state)
Example #9
0
    def check_bad_and_good_values(self, bad_state, good_state):
        # Bad values
        state = self._get_state(bad_state)
        assert_validate_error(self, ValueError, state)

        # Good values
        state = self._get_state(good_state)
        assert_raises_nothing(self, state)
Example #10
0
 def test_that_raises_when_lower_wavelength_is_smaller_than_high_wavelength(
         self):
     state = StateWavelengthAndPixelAdjustment()
     state.wavelength_low = [2.]
     state.wavelength_high = [1.]
     state.wavelength_step = 2.
     state.wavelength_step_type = RangeStepType.Lin
     assert_validate_error(self, ValueError, state)
Example #11
0
    def check_bad_and_good_value(self, bad_convert_to_q, good_convert_to_q):
        # Bad values
        state = self._get_convert_to_q_state(bad_convert_to_q)
        assert_validate_error(self, ValueError, state)

        # Good values
        state = self._get_convert_to_q_state(good_convert_to_q)
        assert_raises_nothing(self, state)
Example #12
0
    def check_bad_and_good_values(self, bad_trans=None, bad_fit=None, good_trans=None, good_fit=None):
        # Bad values
        state = self._get_calculate_transmission_state(bad_trans, bad_fit)
        assert_validate_error(self, ValueError, state)

        # Good values
        state = self._get_calculate_transmission_state(good_trans, good_fit)
        assert_raises_nothing(self, state)
Example #13
0
    def assert_raises_for_bad_value_and_raises_nothing_for_good_value(
            self, data_entries_bad, data_entries_good):
        # Bad values
        state = StateDataTest._get_data_state(**data_entries_bad)
        assert_validate_error(self, ValueError, state)

        # Good values
        state = StateDataTest._get_data_state(**data_entries_good)
        assert_raises_nothing(self, state)
Example #14
0
    def assert_raises_for_bad_value_and_raises_nothing_for_good_value(self, data_entries_bad,
                                                                      data_entries_good):
        # Bad values
        state = StateDataTest._get_data_state(**data_entries_bad)
        assert_validate_error(self, ValueError, state)

        # Good values
        state = StateDataTest._get_data_state(**data_entries_good)
        assert_raises_nothing(self, state)
Example #15
0
 def test_that_raises_if_the_short_detector_name_is_not_set_up(self):
     state = StateMove()
     state.detectors = {DetectorType.to_string(DetectorType.LAB): StateMoveDetector(),
                        DetectorType.to_string(DetectorType.HAB): StateMoveDetector()}
     state.detectors[DetectorType.to_string(DetectorType.HAB)].detector_name = "test"
     state.detectors[DetectorType.to_string(DetectorType.LAB)].detector_name = "test"
     state.detectors[DetectorType.to_string(DetectorType.HAB)].detector_name_short = "test"
     assert_validate_error(self, ValueError, state)
     state.detectors[DetectorType.to_string(DetectorType.LAB)].detector_name_short = "test"
     assert_raises_nothing(self, state)
Example #16
0
    def assert_raises_for_bad_value_and_raises_nothing_for_good_value(self, entry_name=None, bad_value_general=None,
                                                                      bad_value_detector=None, good_value_general=None,
                                                                      good_value_detector=None):
        # Bad values
        bad_value_general_dict = StateMaskTest._get_dict(entry_name, bad_value_general)
        bad_value_detector_dict = StateMaskTest._get_dict(entry_name, bad_value_detector)
        state = self._get_mask_state(bad_value_general_dict, bad_value_detector_dict)
        assert_validate_error(self, ValueError, state)

        # Good values
        good_value_general_dict = StateMaskTest._get_dict(entry_name, good_value_general)
        good_value_detector_dict = StateMaskTest._get_dict(entry_name, good_value_detector)
        state = self._get_mask_state(good_value_general_dict, good_value_detector_dict)
        assert_raises_nothing(self, state)
Example #17
0
 def test_that_raises_when_wavelength_entry_is_missing(self):
     # Arrange
     state = StateWavelengthAndPixelAdjustment()
     assert_validate_error(self, ValueError, state)
     state.wavelength_low = [1.]
     assert_validate_error(self, ValueError, state)
     state.wavelength_high = [2.]
     assert_validate_error(self, ValueError, state)
     state.wavelength_step = 2.
     assert_validate_error(self, ValueError, state)
     state.wavelength_step_type = RangeStepType.Lin
     assert_raises_nothing(self, state)
Example #18
0
 def test_that_raises_when_wavelength_entry_is_missing(self):
     # Arrange
     state = StateWavelengthAndPixelAdjustment()
     assert_validate_error(self, ValueError, state)
     state.wavelength_low = 1.
     assert_validate_error(self, ValueError, state)
     state.wavelength_high = 2.
     assert_validate_error(self, ValueError, state)
     state.wavelength_step = 2.
     assert_validate_error(self, ValueError, state)
     state.wavelength_step_type = RangeStepType.Lin
     assert_raises_nothing(self, state)
Example #19
0
 def test_that_raises_when_wavelength_entry_is_missing(self):
     # Arrange
     state = StateWavelength()
     assert_validate_error(self, ValueError, state)
     state.wavelength_low = [1.]
     assert_validate_error(self, ValueError, state)
     state.wavelength_high = [2.]
     assert_validate_error(self, ValueError, state)
     state.wavelength_step = 2.
     assert_raises_nothing(self, state)
Example #20
0
 def test_that_raises_when_wavelength_entry_is_missing(self):
     # Arrange
     state = StateWavelength()
     assert_validate_error(self, ValueError, state)
     state.wavelength_low = 1.
     assert_validate_error(self, ValueError, state)
     state.wavelength_high = 2.
     assert_validate_error(self, ValueError, state)
     state.wavelength_step = 2.
     assert_raises_nothing(self, state)
Example #21
0
 def test_that_raises_when_lower_wavelength_is_smaller_than_high_wavelength(self):
     state = StateWavelength()
     state.wavelength_low = [2.]
     state.wavelength_high = [1.]
     state.wavelength_step = 2.
     assert_validate_error(self, ValueError, state)
 def assert_raises_for_bad_value_and_raises_nothing_for_good_value(self, entry_name, bad_value, good_value):
     kwargs = {entry_name: bad_value}
     state = self._get_normalize_to_monitor_state(**kwargs)
     assert_validate_error(self, ValueError, state)
     setattr(state, entry_name, good_value)
     assert_raises_nothing(self, state)
Example #23
0
 def test_that_raises_when_only_one_time_is_set(self):
     state = StateSliceEvent()
     state.start_time = [1.0, 2.0]
     assert_validate_error(self, ValueError, state)
     state.end_time = [2.0, 3.0]
Example #24
0
 def test_that_raises_when_only_one_time_is_set(self):
     state = StateSliceEvent()
     state.start_time = [1.0, 2.0]
     assert_validate_error(self, ValueError, state)
     state.end_time = [2.0, 3.0]