dataframely.testing.factory module¶
- dataframely.testing.factory.create_collection(name: str, schemas: dict[str, type[~dataframely.schema.Schema]], filters: dict[str, ~dataframely._filter.Filter] | None = None, *, collection_base_class: type[~dataframely.collection.Collection] = [Collection "CollectionMeta"] Members: , annotation_base_class: type = <class 'dataframely._typing.LazyFrame'>) type[Collection][source]¶
Dynamically create a new collection with the provided name.
- Args:
name: The name of the collection. schemas: The (additional) schemas to use for the collection. filters: The (additional) filters to set on the collection. collection_base_class: The base class for the collection. The new collection
inherits from this collection and also uses all its schemas and filters. Defaults to Collection.
annotation_base_class: The base class for the member’s schemas. Defaults to LazyFrame.
- Returns:
A collection with the given name and the combined schemas and filters.
- dataframely.testing.factory.create_collection_raw(name: str, annotations: dict[str, ~typing.Any], filters: dict[str, ~dataframely._filter.Filter] | None = None, *, collection_base_class: type = [Collection "CollectionMeta"] Members: ) type[Collection][source]¶
- dataframely.testing.factory.create_schema(name: str, columns: dict[str, Column], rules: dict[str, Rule] | None = None) type[Schema][source]¶
Dynamically create a new schema with the provided name.
- Args:
name: The name of the schema. columns: The columns to set on the schema. When properly defining the schema,
this would be the annotations that define the column types.
- rules: The custom non-column-specific validation rules. When properly defining
the schema, this would be the functions annotated with
@dy.rule.
- Returns:
The dynamically created schema.