code: def test_lightning_node_data(get_dataset, strategy_type, loader):
      import pytorch_lightning as pl
  
      dataset = get_dataset(name="Cora")
      data = dataset[0]
      data_repr = (
          "Data(x=[2708, 1433], edge_index=[2, 10556], y=[2708], "
          "train_mask=[2708], val_mask=[2708], test_mask=[2708])"
      )
  
      model = LinearNodeModule(
          dataset.num_features, dataset.num_classes
      )
  
      if strategy_type is None or loader == "full":
          devices = 1
      else:
          devices = torch.cuda.device_count()
  
      if strategy_type == "ddp":
          strategy = pl.strategies.DDPStrategy(accelerator="gpu")
      else:
          strategy = pl.strategies.SingleDeviceStrategy(device="cuda:0")
  
      if (
          loader == "full"
      ):  # Set reasonable defaults for full-batch training:
          batch_size = 1
          num_workers = 0
      else:
          batch_size = 32
          num_workers = 3
      kwargs, kwargs_repr = {}, ""
      if loader == "neighbor":
          kwargs["num_neighbors"] = [5]
          kwargs_repr += "num_neighbors=[5], "
  
      trainer = pl.Trainer(
          strategy=strategy,
          devices=devices,
          max_epochs=5,
          log_every_n_steps=1,
      )
      datamodule = LightningNodeData(
          data,
          loader=loader,
          batch_size=batch_size,
          num_workers=num_workers,
          **kwargs,
      )
  
      old_x = data.x.clone().cpu()
      assert str(datamodule) == (
          f"LightningNodeData(data={data_repr}, "
          f"loader={loader}, batch_size={batch_size}, "
          f"num_workers={num_workers}, {kwargs_repr}"
          f'pin_memory={loader != "full"}, '
          f'persistent_workers={loader != "full"})'
      )
      trainer.fit(model, datamodule)
      trainer.test(model, datamodule)
      new_x = data.x.cpu()
      assert torch.all(new_x > old_x)  # Ensure shared data.
      assert trainer.validate_loop._data_source.is_defined()
      assert trainer.test_loop._data_source.is_defined()
  
imports: import math
  import pytest
  import torch
  import torch.nn.functional
  from torch import Tensor
  from torch_geometric.data import Data, HeteroData
  from torch_geometric.data.lightning import LightningDataset, LightningLinkData, LightningNodeData
  from torch_geometric.nn import global_mean_pool
  from torch_geometric.sampler import BaseSampler, NeighborSampler
  from torch_geometric.testing import MyFeatureStore, MyGraphStore, get_random_edge_index, onlyCUDA, onlyFullTest, onlyNeighborSampler, onlyOnline, withPackage
label_desc: Use image node_id 2 for calling a global function with example usage: test_lightning_node_data(get_dataset, strategy_type, loader) without return types