code: def test_init_parameters(line_graph):
      # if no graph is provided
      with pytest.raises(ValueError):
          UnsupervisedSampler(G=None)
  
      # walk must have length strictly greater than 1
      with pytest.raises(ValueError):
          UnsupervisedSampler(G=line_graph, length=1)
  
      # at least 1 walk from each root node
      with pytest.raises(ValueError):
          UnsupervisedSampler(G=line_graph, number_of_walks=0)
  
      # nodes nodes parameter should be an iterable of node IDs
      with pytest.raises(ValueError):
          UnsupervisedSampler(G=line_graph, nodes=1)
  
      # if no root nodes are provided for sampling defaulting to using all nodes as root nodes
      sampler = UnsupervisedSampler(G=line_graph, nodes=None)
      assert sampler.nodes == list(line_graph.nodes())
  
file_path: stellargraph/tests/data/test_unsupervised_sampler.py
imports: import pytest
  import numpy
  from collections import defaultdict
  from stellargraph.data.unsupervised_sampler import UnsupervisedSampler
  from stellargraph.data.explorer import UniformRandomWalk
  from ..test_utils.graphs import line_graph
label_desc: Use image node_id 1 for calling a global function with example usage: test_init_parameters(line_graph) without return types