code: def test_nodemapper_1():
      n_feat = 4
      n_batch = 2
  
      # test graph
      G1 = example_graph(n_feat)
  
      mapper1 = GraphSAGENodeGenerator(
          G1, batch_size=n_batch, num_samples=[2, 2]
      ).flow(G1.nodes())
      assert len(mapper1) == 2
  
      G2 = example_graph_2(n_feat)
  
      mapper2 = GraphSAGENodeGenerator(
          G2, batch_size=n_batch, num_samples=[2, 2]
      ).flow(G2.nodes())
      assert len(mapper2) == 3
  
      for mapper in [mapper1, mapper2]:
          for ii in range(2):
              nf, nl = mapper[ii]
              assert len(nf) == 3
              assert nf[0].shape == (n_batch, 1, n_feat)
              assert nf[1].shape == (n_batch, 2, n_feat)
              assert nf[2].shape == (n_batch, 2 * 2, n_feat)
              assert nl is None
  
      # Check beyond the graph lengh
      with pytest.raises(IndexError):
          nf, nl = mapper1[len(mapper1)]
  
      # Check the last batch
      nf, nl = mapper2[len(mapper2) - 1]
      assert nf[0].shape == (1, 1, n_feat)
      assert nf[1].shape == (1, 2, n_feat)
      assert nf[2].shape == (1, 2 * 2, n_feat)
  
      # This will fail as the nodes are not in the graph
      with pytest.raises(KeyError):
          GraphSAGENodeGenerator(
              G1, batch_size=2, num_samples=[2, 2]
          ).flow(["A", "B"])
  
imports: from stellargraph.core.graph import *
  from stellargraph.mapper import *
  import networkx
  import numpy
  import random
  import pytest
  import pandas
  import scipy.sparse
  from ..test_utils.graphs import example_graph, example_graph_random, example_hin_1, create_graph_features, repeated_features, weighted_tree
  from ..None import test_utils
label_desc: Use image node_id 7 for calling a global function with example usage: test_nodemapper_1() without return types