def test_from_sklearn():
        """Tests that ``TemplateData`` is properly created when using the ``from_sklearn`` method."""
        data = datasets.load_iris()

        # instantiate the data module
        dm = TemplateData.from_sklearn(
            train_bunch=data,
            val_bunch=data,
            test_bunch=data,
            batch_size=2,
            num_workers=0,
        )
        assert dm is not None
        assert dm.train_dataloader() is not None
        assert dm.val_dataloader() is not None
        assert dm.test_dataloader() is not None

        # check training data
        data = next(iter(dm.train_dataloader()))
        rows, targets = data[DataKeys.INPUT], data[DataKeys.TARGET]
        assert rows.shape == (2, dm.num_features)
        assert targets.shape == (2,)

        # check val data
        data = next(iter(dm.val_dataloader()))
        rows, targets = data[DataKeys.INPUT], data[DataKeys.TARGET]
        assert rows.shape == (2, dm.num_features)
        assert targets.shape == (2,)

        # check test data
        data = next(iter(dm.test_dataloader()))
        rows, targets = data[DataKeys.INPUT], data[DataKeys.TARGET]
        assert rows.shape == (2, dm.num_features)
        assert targets.shape == (2,)
Tests that ``TemplateData`` is properly created when using the ``from_sklearn`` method.
tests/template/classification/test_data.py