Hi , I'm developing a custom dataset which uses custom hooks. Now I dont know how to unittest these hooks?
My hook looks like
class MetadataHooks:
"""Kedro hook implementations for metadata handling."""
def __init__(self) -> None:
"""Initializes the hook with default values."""
self._metadata: dict[str, Any] = {}
self._manipulated_at = datetime.now(timezone.utc).isoformat()
@hook_impl(tryfirst=True)
def before_pipeline_run(self, catalog: CatalogProtocol[Any, Any]) -> None:
"""Attach the shared session to every Snowpark dataset in the catalog.
Args:
catalog: The data catalog, which contains all datasets.
"""
for name, dataset in catalog.items():
if isinstance(dataset, SnowparkTableDataset):
metadata = dataset.metadata or {}
dataset.metadata = {**metadata, "_manipulated_at": self._manipulated_at}
logger.debug("Attached metadata %s to Snowpark datasets %s", self._metadata, name)
I want to test whether the dataset contains the metadata after the hook got executed. How do I do that?
I saw the page about the automated testing
https://kedro1.readthedocs.io/en/0.19.0.post4/development/automated_testing.html but dont really get it.
Thanks for your help