code: def test_walk_generation_single_root_node_self_loner(self):
      g = create_test_graph()
      mrw = UniformRandomMetaPathWalk(g)
  
      seed = None
      nodes = [
          "self loner"
      ]  # this node has self edges but not other edges
      n = 1
      length = 10
      metapaths = [["s", "n", "n", "s"]]
  
      walks = mrw.run(
          nodes=nodes,
          n=n,
          length=length,
          metapaths=metapaths,
          seed=seed,
      )
      assert len(walks) == n
      assert (
          len(walks[0]) == 1
      )  # for the ['s', 'n', 'n', 's'] metapath only the starting node is returned
  
      metapaths = [["s", "s"]]
      walks = mrw.run(
          nodes=nodes,
          n=n,
          length=length,
          metapaths=metapaths,
          seed=seed,
      )
      assert len(walks) == n
      assert (
          len(walks[0]) == length
      )  # the node is repeated length times
      for node in walks[0]:
          assert node == "self loner"
  
file_path: stellargraph/tests/data/test_metapath_walker.py
imports: import pandas
  import numpy
  import pytest
  from stellargraph.data.explorer import UniformRandomMetaPathWalk
  from stellargraph.core.graph import StellarGraph
  from ..test_utils.graphs import example_graph_random
label_desc: Use image node_id 3 for calling the TestMetaPathWalk obj's underlying member method code with example usage: obj.test_walk_generation_single_root_node_self_loner() without return types