code: def test_ItemSet_seed_nodes():
      # Node IDs with tensor.
      item_set = gb.ItemSet(torch.arange(0, 5), names="seed_nodes")
      assert item_set.names == ("seed_nodes",)
      # Iterating over ItemSet and indexing one by one.
      for i, item in enumerate(item_set):
          assert i == item.item()
          assert i == item_set[i]
      # Indexing with a slice.
      assert torch.equal(item_set[:], torch.arange(0, 5))
      # Indexing with an Iterable.
      assert torch.equal(
          item_set[torch.arange(0, 5)], torch.arange(0, 5)
      )
  
      # Node IDs with single integer.
      item_set = gb.ItemSet(5, names="seed_nodes")
      assert item_set.names == ("seed_nodes",)
      # Iterating over ItemSet and indexing one by one.
      for i, item in enumerate(item_set):
          assert i == item.item()
          assert i == item_set[i]
      # Indexing with a slice.
      assert torch.equal(item_set[:], torch.arange(0, 5))
      # Indexing with an integer.
      assert item_set[0] == 0
      assert item_set[-1] == 4
      # Indexing that is out of range.
      with pytest.raises(
          IndexError, match="ItemSet index out of range."
      ):
          _ = item_set[5]
      with pytest.raises(
          IndexError, match="ItemSet index out of range."
      ):
          _ = item_set[-10]
      # Indexing with tensor.
      with pytest.raises(
          TypeError, match="ItemSet indices must be integer or slice."
      ):
          _ = item_set[torch.arange(3)]
  
imports: import re
  import dgl
  import pytest
  import torch
  from dgl import graphbolt
  from torch.testing import assert_close
label_desc: Use image node_id 3 for calling a global function with example usage: test_ItemSet_seed_nodes() without return types