code: def test_get_source_target(
      source_cfg,
      target_cfg,
      valid_ratio,
      weight_type,
      datasize_type,
      testing_cfg,
      class_subset,
  ):
      (
          source_name,
          source_n_class,
          source_trainlist,
          source_testlist,
      ) = source_cfg.split(";")
      (
          target_name,
          target_n_class,
          target_trainlist,
          target_testlist,
      ) = target_cfg.split(";")
      n_class = eval(min(source_n_class, target_n_class))
  
      # get cfg parameters
      cfg = testing_cfg
      cfg.DATASET.SOURCE = source_name
      cfg.DATASET.SRC_TRAINLIST = source_trainlist
      cfg.DATASET.SRC_TESTLIST = source_testlist
      cfg.DATASET.TARGET = target_name
      cfg.DATASET.TGT_TRAINLIST = target_trainlist
      cfg.DATASET.TGT_TESTLIST = target_testlist
      cfg.DATASET.WEIGHT_TYPE = weight_type
      cfg.DATASET.SIZE_TYPE = datasize_type
  
      # test get_source_target
      source, target, num_classes = VideoDataset.get_source_target(
          VideoDataset(source_name),
          VideoDataset(target_name),
          seed,
          cfg,
      )
  
      assert num_classes == n_class
      assert isinstance(source, dict)
      assert isinstance(target, dict)
      assert isinstance(source["rgb"], VideoDatasetAccess)
      assert isinstance(target["rgb"], VideoDatasetAccess)
      assert isinstance(source["flow"], VideoDatasetAccess)
      assert isinstance(target["flow"], VideoDatasetAccess)
  
      # test get_train & get_test
      assert isinstance(
          source["rgb"].get_train(), torch.utils.data.Dataset
      )
      assert isinstance(
          source["rgb"].get_test(), torch.utils.data.Dataset
      )
      assert isinstance(
          source["flow"].get_train(), torch.utils.data.Dataset
      )
      assert isinstance(
          source["flow"].get_test(), torch.utils.data.Dataset
      )
  
      # test get_train_valid
      train_valid = source["rgb"].get_train_valid(valid_ratio)
      assert isinstance(train_valid, list)
      assert isinstance(train_valid[0], torch.utils.data.Dataset)
      assert isinstance(train_valid[1], torch.utils.data.Dataset)
  
      # test action_multi_domain_datasets
      dataset = VideoMultiDomainDatasets(
          source,
          target,
          image_modality=cfg.DATASET.IMAGE_MODALITY,
          seed=seed,
          config_weight_type=cfg.DATASET.WEIGHT_TYPE,
          config_size_type=cfg.DATASET.SIZE_TYPE,
      )
      assert isinstance(dataset, DomainsDatasetBase)
  
      # test class subsets
      if source_cfg == SOURCES[1] and target_cfg == TARGETS[0]:
          dataset_subset = VideoMultiDomainDatasets(
              source,
              target,
              image_modality="rgb",
              seed=seed,
              config_weight_type=cfg.DATASET.WEIGHT_TYPE,
              config_size_type=cfg.DATASET.SIZE_TYPE,
              class_ids=class_subset,
          )
  
          train, valid = source["rgb"].get_train_valid(valid_ratio)
          test = source["rgb"].get_test()
          dataset_subset._rgb_source_by_split = {}
          dataset_subset._rgb_target_by_split = {}
          dataset_subset._rgb_source_by_split[
              "train"
          ] = get_class_subset(train, class_subset)
          dataset_subset._rgb_target_by_split[
              "train"
          ] = dataset_subset._rgb_source_by_split["train"]
          dataset_subset._rgb_source_by_split[
              "valid"
          ] = get_class_subset(valid, class_subset)
          dataset_subset._rgb_source_by_split[
              "test"
          ] = get_class_subset(test, class_subset)
  
          # Ground truth length of the subset dataset
          train_dataset_subset_length = len(
              [1 for data in train if data[1] in class_subset]
          )
          valid_dataset_subset_length = len(
              [1 for data in valid if data[1] in class_subset]
          )
          test_dataset_subset_length = len(
              [1 for data in test if data[1] in class_subset]
          )
          assert (
              len(dataset_subset._rgb_source_by_split["train"])
              == train_dataset_subset_length
          )
          assert (
              len(dataset_subset._rgb_source_by_split["valid"])
              == valid_dataset_subset_length
          )
          assert (
              len(dataset_subset._rgb_source_by_split["test"])
              == test_dataset_subset_length
          )
          assert len(dataset_subset) == train_dataset_subset_length
  
file_path: pykale/tests/loaddata/test_video_access.py
imports: import pytest
  import torch
  from yacs.config import CfgNode
  from kale.loaddata.dataset_access import get_class_subset
  from kale.loaddata.multi_domain import DomainsDatasetBase
  from kale.loaddata.video_access import get_image_modality, VideoDataset, VideoDatasetAccess
  from kale.loaddata.video_multi_domain import VideoMultiDomainDatasets
  from kale.utils.seed import set_seed
label_desc: Use image node_id 3 for calling a global function with example usage: test_get_source_target(source_cfg, target_cfg, valid_ratio, weight_type, datasize_type, testing_cfg, class_subset) without return types