def test_attach_config_to_object(self): config = { 'integer': 1, 'numlist': [1, 2, 3], 'string': 'foobarbaz' } obj = type("TestObj", (object,), {}) attach_config_to_object(obj, config) for k, v in config.items(): self.assertEqual(v, getattr(obj, k))
def __init__(self, filepath, loop=None, **kwargs): super().__init__(filepath, loop) config = copy.copy(self.DEFAULTS) config.update(kwargs) self._config = kwargs attach_config_to_object(self, config) self.backend = S3ArtifactBackend( s3_bucket_name=conf.test_bucket_name, aws_region=conf.test_region, aws_profile=conf.test_profile, dynamodb_artifact_table_name=conf. test_dynamodb_artifact_table_name, dynamodb_stage_run_table_name=conf.test_dynamodb_stage_run_name)
def __init__(self, key, data): if not name_is_pythonic(key): raise NonPythonicNameError(symbol=key) if not isinstance(data, dict): raise TypeError('Expected type \'dict\', found %s instead.' % type(data)) attach_config_to_object(self, data) self.name = key self.raw_config = data if not hasattr(self, "type"): raise MissingPipelineAttributeError(attribute="type", stage_name=key) if not self.type.endswith('PipelineStage'): self.type += 'PipelineStage' if self.type not in STAGES: raise IncorrectPipelineStageNameError(types=list(STAGES.keys())) self.parent_class = STAGES[self.type]
def __init__(self, **kwargs): config = copy.copy(self.DEFAULTS) config.update(kwargs) self._validate_config() self._config = kwargs attach_config_to_object(self, config)