Features

This section describes all features that are shipped with this package.

Scenario Features

class balderhub.data.lib.scenario_features.AbstractDataItemRelatedFeature(**kwargs)

Bases: Feature

Base factory usable feature. All Features that should be creatable by a factory class needs to be a subclass of this feature class.

property data_item_type: Type[SingleDataItem]
Returns:

returns the type of the data item, this feature belongs too

classmethod get_specific_feature_for(data_item_type: Type[SingleDataItem], **vdevice_mapping)

This method returns an instantiated feature object that was previously registered for the provided data_item_type.

Parameters:
  • data_item_type – the data item type the new instance should be for

  • vdevice_mapping – optional a vdevice mapping for the feature # TODO do use dict here

Returns:

returns a feature object of this type that was defined for the provided data_item_type

classmethod register_feature_with_data_item_type(feature_cls: type[balderhub.data.lib.scenario_features.abstract_data_item_related_feature.AbstractDataItemRelatedFeature], data_item_type: Type[SingleDataItem]) None

Internally used class for managing the correct assignment of data item type to that feature.

Parameters:
  • feature_cls – the feature class type that should be registered

  • data_item_type – the data item type that should be assigned to the provided feature_cls

classmethod set_data_item_type(data_item_type: Type[SingleDataItem]) None

This class method sets the data-item type. This method is normally called by the decorator @register_for_data_item().

Parameters:

data_item_type – the data item type

class balderhub.data.lib.scenario_features.AccessibleInitialDataConfig(**kwargs)

Bases: InitialDataConfig

This config feature returns a list of data item elements, that is accessible for the using device.

property data_list: SingleDataItemCollection
Returns:

returns the data item collection this config feature describes

class balderhub.data.lib.scenario_features.DataEnvironmentFeature(**kwargs)

Bases: Feature

The Data Environment Feature provides an interface for managing a big data set. It helps to configure your tests depending on the selected data sets. You can use it to create a nested data-environment structure and define different data sets for different setups.

exception DoesNotExist

Bases: Exception

error that is thrown if an element does that is requested by some methods does not exist in the environment

get(data_obj_type: Type[SingleDataItemTypeT], unique_identification: Any) SingleDataItemTypeT

This method returns exactly one element identified by the unique_identification. It raises an exception if the requested element does not exist in the environment.

Parameters:
  • data_obj_type – the data-item type

  • unique_identification – the unique-identification value of the requested data-item type

Returns:

the specific data item

get_all_for(data_obj_type: Type[SingleDataItemTypeT]) SingleDataItemCollection

This method returns all known data-items for a specific data item type. :param data_obj_type: the data-item type :return: a list of all known data-items

load_data() None

This method will be executed to generate / load the data for this environment into the object. You need to overwrite it in subclass to fill the data environment with data.

sync_environment() None

This method executes the transfer of the environment in the related system. It should handle the creation of the stored data with the related system. It is expected that after calling this method, the environment data and the data within the related system are in sync.

class balderhub.data.lib.scenario_features.InitialDataConfig(**kwargs)

Bases: AbstractDataItemRelatedFeature

This config feature returns a list of data item elements.

property data_list: SingleDataItemCollection
Returns:

returns the data item collection this config feature describes

Scenario Factories

class balderhub.data.lib.scenario_features.factories.AutoAccessibleInitialDataConfigFactory

Bases: AutoFeatureFactory

Factory for creating data-item bounded scenario-based config-feature AccessibleInitialDataConfig

class balderhub.data.lib.scenario_features.factories.AutoInitialDataConfigFactory

Bases: AutoFeatureFactory

Factory for creating data-item bounded scenario-based config-feature InitialDataConfig

Setup Features

Note

This package does not provide any setup features.

Setup Factories

class balderhub.data.lib.setup_features.factories.AutoAccessibleInitialDataConfigFactory

Bases: AutoFeatureFactory

Factory for creating data-item bounded scenario-based config-feature MultipleDataConfig by using the defined data within a DataEnvironmentFeature.

classmethod get_for(data_item_cls: type[balderhub.data.lib.utils.single_data_item.SingleDataItem], filter_func: Callable[[SingleDataItem], bool] | None = None, **kwargs)

Defines a new feature for the specific data-item class given by attribute data_item_cls.

Parameters:
  • data_item_cls – the single data-item class

  • kwargs – optional further attributes that will be forwarded to internal method AutoFeatureFactory.register_cls() and AutoFeatureFactory._define_class().

Returns:

the feature type class

class balderhub.data.lib.setup_features.factories.AutoInitialDataConfigFactory

Bases: AutoFeatureFactory

Factory for creating data-item bounded scenario-based config-feature MultipleDataConfig by using the defined data within a DataEnvironmentFeature.