def test_context_id(self): context_info = ContextInfo() assert context_info.context_id is not None update = "new context_id" context_info.context_id = update assert context_info.context_id == "new context_id"
def test_description(self): context_info = ContextInfo() assert context_info.description is None update = "new description" context_info.description = update assert context_info.description == "new description"
def test_name(self): context_info = ContextInfo("unknown") assert context_info.name == "unknown" update = "new name" context_info.name = update assert context_info.name == "new name"
def test_start_time(self): context_info = ContextInfo() now = datetime.datetime.now() assert context_info.start_time.year == now.year assert context_info.start_time.month == now.month context_info.start_time = datetime.datetime(1975, 4, 8) assert context_info.start_time.year == 1975 assert context_info.start_time.month == 4 assert context_info.start_time.day == 8
def test_from_config(self): config = ConfigParams.from_tuples("name", "new name", "description", "new description", "properties.access_key", "key", "properties.store_key", "store key") context_info = ContextInfo.from_config(config) assert context_info.name == "new name" assert context_info.description == "new description"
def __init__(self, name=None, description=None): """ Creates a new instance of the container. :param name: (optional) a container name (accessible via ContextInfo) :param description: (optional) a container description (accessible via ContextInfo) """ self._logger = NullLogger() self._info = ContextInfo(name, description) self._factories = DefaultContainerFactory()
def __init__(self, name: str = None, description: str = None): """ Creates a new instance of the container. :param name: (optional) a container name (accessible via ContextInfo) :param description: (optional) a container description (accessible via ContextInfo) """ self._config: ContainerConfig = None self._references: ContainerReferences = None self._logger: ILogger = NullLogger() self._info: ContextInfo = ContextInfo(name, description) self._factories: DefaultContainerFactory = DefaultContainerFactory()