code: def test_initial_metadata(mock_file, makedirs):
      # given
      resolved_path = MagicMock(
          spec=Path,
          exists=lambda: False,
      )
      file_path = MagicMock(
          spec=Path, resolve=lambda strict: resolved_path
      )
      data_path = MagicMock(
          spec=Path, __truediv__=lambda self, key: file_path
      )
  
      # when
      with MetadataFile(
          data_path=data_path,
          metadata={"version": 5, "dependencies": ["a==1.0", "b==2.0"]},
      ):
          # then
          makedirs.assert_called_with(data_path, exist_ok=True)
          mock_file.assert_called_with(resolved_path, "w")
  
          # and - concatenate all written content
          write_calls = mock_file().write.call_args_list
          written_content = "".join(call[0][0] for call in write_calls)
          assert written_content == sample_content
  
imports: from pathlib import Path
  from mock import MagicMock, mock_open, patch
  from neptune.internal.metadata_file import MetadataFile
label_desc: Use image node_id 4 for calling a global function with example usage: test_initial_metadata(mock_file, makedirs) without return types