code: def test_file_changed_during_upload(self, environment, monkeypatch):
      key = self.gen_key()
      file_size = 11 * SIZE_1MB  # 11 MB, multipart with 3 parts
      intermediate_size = 6 * SIZE_1MB  # 6 MB, second part < 5MB
      filename = fake.file_name()
      downloaded_filename = fake.file_name()
  
      _upload_raw_data = hosted_file_operations.upload_raw_data
  
      run = initialize_container(
          container_type="run",
          project=environment.project,
          mode="sync",
      )
  
      with tmp_context():
          # create file_size file
          with open(filename, "wb") as file:
              file.write(b"\0" * file_size)
  
          class UploadedFileChanger:
              def __init__(self):
                  self.upload_part_iteration = 0
  
              def __call__(self, *args, **kwargs):
                  # file starts to change and after uploading first part it's at intermediate_size
                  if self.upload_part_iteration == 0:
                      with open(filename, "wb") as file:
                          file.write(b"\0" * intermediate_size)
                  # after that it's back at file_size
                  elif self.upload_part_iteration == 1:
                      with open(filename, "wb") as file:
                          file.write(b"\0" * file_size)
                  self.upload_part_iteration += 1
  
                  return _upload_raw_data(*args, **kwargs)
  
          hacked_upload_raw_data = UploadedFileChanger()
          monkeypatch.setattr(
              hosted_file_operations,
              "upload_raw_data",
              Mock(wraps=hacked_upload_raw_data),
          )
  
          run[key].upload(filename)
  
          run[key].download(downloaded_filename)
  
          assert os.path.getsize(downloaded_filename) == file_size
          with open(downloaded_filename, "rb") as file:
              content = file.read()
              assert len(content) == file_size
              assert content == b"\0" * file_size
          # handling restart + 3 for actual upload
          assert hacked_upload_raw_data.upload_part_iteration == 5
  
imports: import io
  import os
  import random
  import uuid
  from itertools import product
  from typing import Set
  from unittest.mock import Mock
  from zipfile import ZipFile
  import pytest
  from neptune.internal.backends import hosted_file_operations
  from neptune.internal.backends.api_model import MultipartConfig, OptionalFeatures
  from neptune.internal.backends.hosted_neptune_backend import HostedNeptuneBackend
  from neptune.internal.types.file_types import FileType
  from neptune.metadata_containers import MetadataContainer
  from neptune.types import File, FileSet
  from tests.e2e.base import AVAILABLE_CONTAINERS, BaseE2ETest, fake
  from tests.e2e.plot_utils import generate_altair_chart, generate_brokeh_figure, generate_matplotlib_figure, generate_pil_image, generate_plotly_figure, generate_seaborn_figure
  from tests.e2e.utils import SIZE_1KB, SIZE_1MB, initialize_container, preserve_cwd, tmp_context
label_desc: Use image node_id 5 for calling the TestUpload obj's underlying member method code with example usage: obj.test_file_changed_during_upload(environment, monkeypatch) and returns: _upload_raw_data