class_docstr: Tests ``TemplateData``.
docstr: Tests that ``TemplateData`` is properly created when using the ``from_sklearn`` method.
code: 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,)
  
file_path: lightning-flash/tests/template/classification/test_data.py
imports: import numpy
  import pytest
  from flash.core.data.io.input import DataKeys
  from flash.core.utilities.imports import _SKLEARN_AVAILABLE, _TOPIC_CORE_AVAILABLE
  from flash.template.classification.data import TemplateData
label_desc: Use image node_id 3 for calling the TestTemplateData obj's underlying member method code with example usage: obj.test_from_sklearn() without return types