code: def test_write_simple_file(self):
      tractogram = Tractogram(
          DATA["streamlines"], affine_to_rasmm=np.eye(4)
      )
  
      tck_file = BytesIO()
      tck = TckFile(tractogram)
      tck.save(tck_file)
      tck_file.seek(0, os.SEEK_SET)
  
      new_tck = TckFile.load(tck_file)
      assert_tractogram_equal(new_tck.tractogram, tractogram)
  
      new_tck_orig = TckFile.load(DATA["simple_tck_fname"])
      assert_tractogram_equal(
          new_tck.tractogram, new_tck_orig.tractogram
      )
  
      tck_file.seek(0, os.SEEK_SET)
      assert (
          tck_file.read() == open(DATA["simple_tck_fname"], "rb").read()
      )
  
      # TCK file containing not well formatted entries in its header.
      tck_file = BytesIO()
      tck = TckFile(tractogram)
      tck.header["new_entry"] = "val:ue"  # : not allowed
      with pytest.raises(HeaderError):
          tck.save(tck_file)
  
imports: import os
  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 data_path, error_warnings
  from ..None import tck
  from ..array_sequence import ArraySequence
  from ..tck import TckFile
  from ..tractogram import Tractogram
  from ..tractogram_file import DataError, HeaderError, HeaderWarning
  from .test_tractogram import assert_tractogram_equal
label_desc: Use image node_id 12 for calling the TestTCK obj's underlying member method code with example usage: obj.test_write_simple_file() without return types