code: def test_cw_size_and_walk_length(temporal_graph, cw_size):
      rw = TemporalRandomWalk(temporal_graph)
      num_cw = 5
      max_walk_length = 3
  
      def run():
          return rw.run(
              num_cw=num_cw,
              cw_size=cw_size,
              max_walk_length=max_walk_length,
          )
  
      if cw_size < 2:
          with pytest.raises(
              ValueError, match=r".* context window size .*"
          ):
              run()
      elif max_walk_length < cw_size:
          with pytest.raises(
              ValueError, match=r".* maximum walk length .*"
          ):
              run()
      else:
          walks = run()
          num_cw_obtained = sum(
              [len(walk) - cw_size + 1 for walk in walks]
          )
          assert num_cw == num_cw_obtained
          assert max(map(len, walks)) <= max_walk_length
  
file_path: stellargraph/tests/data/test_temporal_random_walker.py
imports: import pandas
  import pytest
  import numpy
  import networkx
  from stellargraph.data.explorer import TemporalRandomWalk
  from stellargraph.core.graph import StellarGraph
label_desc: Use image node_id 6 for calling a global function with example usage: test_cw_size_and_walk_length(temporal_graph, cw_size) and returns: rw