code: def test_lazy_tractogram_creation(self):
      # To create tractogram from arrays use `Tractogram`.
      with pytest.raises(TypeError):
          LazyTractogram(streamlines=DATA["streamlines"])
  
      # Streamlines and other data as generators
      streamlines = (x for x in DATA["streamlines"])
      data_per_point = {"colors": (x for x in DATA["colors"])}
      data_per_streamline = {
          "torsion": (x for x in DATA["mean_torsion"]),
          "colors": (x for x in DATA["mean_colors"]),
      }
  
      # Creating LazyTractogram with generators is not allowed as
      # generators get exhausted and are not reusable unlike generator
      # function.
      with pytest.raises(TypeError):
          LazyTractogram(streamlines=streamlines)
      with pytest.raises(TypeError):
          LazyTractogram(data_per_point={"none": None})
      with pytest.raises(TypeError):
          LazyTractogram(data_per_streamline=data_per_streamline)
      with pytest.raises(TypeError):
          LazyTractogram(
              streamlines=DATA["streamlines"],
              data_per_point=data_per_point,
          )
  
      # Empty `LazyTractogram`
      tractogram = LazyTractogram()
      with pytest.warns(
          Warning,
          match="Number of streamlines will be determined manually",
      ):
          check_tractogram(tractogram)
      assert tractogram.affine_to_rasmm is None
  
      # Create tractogram with streamlines and other data
      tractogram = LazyTractogram(
          DATA["streamlines_func"],
          DATA["data_per_streamline_func"],
          DATA["data_per_point_func"],
      )
  
      assert is_lazy_dict(tractogram.data_per_streamline)
      assert is_lazy_dict(tractogram.data_per_point)
  
      [t for t in tractogram]  # Force iteration through tractogram.
      assert len(tractogram) == len(DATA["streamlines"])
  
      # Generator functions get re-called and creates new iterators.
      for i in range(2):
          assert_tractogram_equal(tractogram, DATA["tractogram"])
  
imports: import copy
  import operator
  import sys
  import unittest
  import warnings
  from collections import defaultdict
  import numpy
  import pytest
  from numpy.testing import assert_array_almost_equal, assert_array_equal
  from ...testing import assert_arrays_equal, clear_and_catch_warnings
  from ..None import tractogram
  from ..tractogram import LazyDict, LazyTractogram, PerArrayDict, PerArraySequenceDict, Tractogram, TractogramItem, is_data_dict, is_lazy_dict
label_desc: Use image node_id 1 for calling the TestLazyTractogram obj's underlying member method code with example usage: obj.test_lazy_tractogram_creation() without return types