code: def test_load_write_file(self):
      for fname in [DATA["empty_tck_fname"], DATA["simple_tck_fname"]]:
          for lazy_load in [False, True]:
              tck = TckFile.load(fname, lazy_load=lazy_load)
              tck_file = BytesIO()
              tck.save(tck_file)
  
              loaded_tck = TckFile.load(fname, lazy_load=False)
              assert_tractogram_equal(
                  loaded_tck.tractogram, tck.tractogram
              )
  
              # Check that the written file is the same as the one read.
              tck_file.seek(0, os.SEEK_SET)
              assert tck_file.read() == open(fname, "rb").read()
  
      # Save tractogram that has an affine_to_rasmm.
      for lazy_load in [False, True]:
          tck = TckFile.load(
              DATA["simple_tck_fname"], lazy_load=lazy_load
          )
          affine = np.eye(4)
          affine[0, 0] *= -1  # Flip in X
          tractogram = Tractogram(
              tck.streamlines, affine_to_rasmm=affine
          )
  
          new_tck = TckFile(tractogram, tck.header)
          tck_file = BytesIO()
          new_tck.save(tck_file)
          tck_file.seek(0, os.SEEK_SET)
  
          loaded_tck = TckFile.load(tck_file, lazy_load=False)
          assert_tractogram_equal(
              loaded_tck.tractogram, tractogram.to_world(lazy=True)
          )
  
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 14 for calling the TestTCK obj's underlying member method code with example usage: obj.test_load_write_file() without return types