def test_out_of_range(self): """ Verify out of range values raise exceptions """ self.assert_initialize_driver() constraints = ParameterConstraints.dict() parameters = Parameter.dict() log.debug(constraints) for key in constraints: _, minimum, maximum = constraints[key] parameter = parameters[key] self.assert_set_exception(parameter, minimum - 1) self.assert_set_exception(parameter, maximum + 1) self.assert_set_exception(parameter, "strings aren't valid here!")
def test_driver_enums(self): """ Verify that all driver enumeration has no duplicate values that might cause confusion. Also do a little extra validation for the Capabilities """ self.assert_enum_has_no_duplicates(DataParticleType()) self.assert_enum_has_no_duplicates(ProtocolState()) self.assert_enum_has_no_duplicates(ProtocolEvent()) self.assert_enum_has_no_duplicates(Parameter()) self.assert_enum_has_no_duplicates(InstrumentCommand()) # Test capabilities for duplicates, them verify that capabilities is a subset of protocol events self.assert_enum_has_no_duplicates(Capability()) self.assert_enum_complete(Capability(), ProtocolEvent())
def test_get_set_parameters(self): """ verify that all parameters can be get set properly, this includes ensuring that read only parameters fail on set. """ self.assert_enter_command_mode() constraints = ParameterConstraints.dict() parameters = Parameter.reverse_dict() startup_params = self.test_config.driver_startup_config[DriverConfigKey.PARAMETERS] for key, value in startup_params.items(): self.assert_get_parameter(key, value) if key in parameters and parameters[key] in constraints: _, minimum, maximum = constraints[parameters[key]] self.assert_set_parameter(key, maximum-1) else: self.assert_set_parameter(key, value + 1)
def test_set_parameters(self): """ Verify we can set all parameters """ self.assert_initialize_driver() constraints = ParameterConstraints.dict() parameters = Parameter.reverse_dict() startup_params = self.test_config.driver_startup_config[DriverConfigKey.PARAMETERS] for key, value in startup_params.iteritems(): if key in parameters and parameters[key] in constraints: _, minimum, maximum = constraints[parameters[key]] self.assert_set(key, maximum-1) else: self.assert_set(key, value + 1) self.assert_set_bulk(startup_params)