code: def test_write_too_many_scalars_and_properties(self):
      # TRK supports up to 10 data_per_point.
      data_per_point = {}
      for i in range(10):
          data_per_point[f"#{i}"] = DATA["fa"]
  
          tractogram = Tractogram(
              DATA["streamlines"],
              data_per_point=data_per_point,
              affine_to_rasmm=np.eye(4),
          )
  
          trk_file = BytesIO()
          trk = TrkFile(tractogram)
          trk.save(trk_file)
          trk_file.seek(0, os.SEEK_SET)
  
          new_trk = TrkFile.load(trk_file, lazy_load=False)
          assert_tractogram_equal(new_trk.tractogram, tractogram)
  
      # More than 10 data_per_point should raise an error.
      data_per_point[f"#{i + 1}"] = DATA["fa"]
  
      tractogram = Tractogram(
          DATA["streamlines"],
          data_per_point=data_per_point,
          affine_to_rasmm=np.eye(4),
      )
  
      trk = TrkFile(tractogram)
      with pytest.raises(ValueError):
          trk.save(BytesIO())
  
      # TRK supports up to 10 data_per_streamline.
      data_per_streamline = {}
      for i in range(10):
          data_per_streamline[f"#{i}"] = DATA["mean_torsion"]
  
          tractogram = Tractogram(
              DATA["streamlines"],
              data_per_streamline=data_per_streamline,
              affine_to_rasmm=np.eye(4),
          )
  
          trk_file = BytesIO()
          trk = TrkFile(tractogram)
          trk.save(trk_file)
          trk_file.seek(0, os.SEEK_SET)
  
          new_trk = TrkFile.load(trk_file, lazy_load=False)
          assert_tractogram_equal(new_trk.tractogram, tractogram)
  
      # More than 10 data_per_streamline should raise an error.
      data_per_streamline[f"#{i + 1}"] = DATA["mean_torsion"]
  
      tractogram = Tractogram(
          DATA["streamlines"], data_per_streamline=data_per_streamline
      )
  
      trk = TrkFile(tractogram)
      with pytest.raises(ValueError):
          trk.save(BytesIO())
  
imports: import copy
  import os
  import sys
  import unittest
  from io import BytesIO
  from os.path import join
  import numpy
  import pytest
  from numpy.testing import assert_array_equal
  from ...testing import assert_arr_dict_equal, clear_and_catch_warnings, data_path, error_warnings
  from ..None import trk
  from ..header import Field
  from ..tractogram import Tractogram
  from ..tractogram_file import HeaderError, HeaderWarning
  from ..trk import TrkFile, decode_value_from_name, encode_value_in_name, get_affine_trackvis_to_rasmm
  from .test_tractogram import assert_tractogram_equal
label_desc: Use image node_id 15 for calling the TestTRK obj's underlying member method code with example usage: obj.test_write_too_many_scalars_and_properties() without return types