class_docstr: Tests of HinSAGELinkGenerator class
docstr: This tests link generator's iterator for prediction, i.e., without targets provided
docstr_tok: ["This","tests","link","generator","'s","iterator","for","prediction",",","i.e.",",","without","targets","provided"]
code: def test_HinSAGELinkGenerator_isolates(self):
      """
      This tests link generator's iterator for prediction, i.e., without targets provided
      """
      n_batch = 2
      n_samples = [2, 2]
  
      feature_size_by_type = {"A": 4, "B": 2}
      nodes_by_type = {"A": 5, "B": 5}
      n_isolates_by_type = {"A": 0, "B": 2}
      edges_by_type = {("A", "A"): 5, ("A", "B"): 10}
      Gh, hnodes = example_hin_random(
          feature_size_by_type,
          nodes_by_type,
          n_isolates_by_type,
          edges_by_type,
      )
  
      # Non-isolate + isolate
      head_links = [(hnodes["A"][0], hnodes["B"][-1])]
      gen = HinSAGELinkGenerator(
          Gh,
          batch_size=n_batch,
          num_samples=n_samples,
          head_node_types=["A", "B"],
      )
      flow = gen.flow(head_links)
  
      ne, nl = flow[0]
      assert len(gen._sampling_schema[0]) == len(ne)
      assert pytest.approx([1, 1, 2, 2, 2, 4, 4, 4, 4, 4]) == [
          x.shape[1] for x in ne
      ]
  
      # Two isolates
      head_links = [(hnodes["B"][-2], hnodes["B"][-1])]
      gen = HinSAGELinkGenerator(
          Gh,
          batch_size=n_batch,
          num_samples=n_samples,
          head_node_types=["B", "B"],
      )
      flow = gen.flow(head_links)
  
      ne, nl = flow[0]
      assert len(gen._sampling_schema[0]) == len(ne)
      assert pytest.approx([1, 1, 2, 2, 4, 4, 4, 4]) == [
          x.shape[1] for x in ne
      ]
  
      # With two isolates, all features are zero
      assert all(pytest.approx(0) == x for x in ne[2:])
  
imports: import numpy
  import networkx
  import pytest
  import random
  from stellargraph.mapper import *
  from stellargraph.core.graph import *
  from stellargraph.data.unsupervised_sampler import *
  from ..test_utils.graphs import example_graph, example_graph_random, example_hin_1, repeated_features, weighted_tree
  from ..None import test_utils
label_desc: Use image node_id 7 for calling the Test_HinSAGELinkGenerator obj's underlying member method code with example usage: obj.test_HinSAGELinkGenerator_isolates() without return types