code: def test_save_no_junk(tmpdir):
      """Test for an issue with save() not having O_TRUNC mode
      resulting in possible junk at the end of file if it already exists
      """
      try:
          import onnx
      except ImportError:
          pytest.skip("ONNX is not installed.")
  
      filename = os.path.join(str(tmpdir), R"no_junk.onnx")
      filename_new = os.path.join(str(tmpdir), R"no_junk_new.onnx")
  
      # Save a large model.
      g = C.ceil([1, 2, 3, 4, 5, 6, 7, 8] * 100)
      g.save(filename, format=C.ModelFormat.ONNX)
  
      # Save a smaller model using the same file name and a new file name.
      g = C.ceil([1, 2, 3, 4, 5, 6, 7] * 100)
      g.save(filename, format=C.ModelFormat.ONNX)
      g.save(filename_new, format=C.ModelFormat.ONNX)
  
      # Check the files can be loaded as standard ONNX files,
      # and both result in the same model.
      assert onnx.load(filename) == onnx.load(filename_new)
  
file_path: CNTK/bindings/python/cntk/tests/onnx_format_test.py
imports: import os
  import numpy
  import cntk
  from cntk.ops.tests.ops_test_utils import cntk_device
  import pytest
label_desc: Use image node_id 12 for calling a global function with example usage: test_save_no_junk(tmpdir) without return types