code: def test_atomic_write(tmpdir):
      fname = tmpdir.join("ha")
      for i in range(2):
          with atomic_write(str(fname), overwrite=True) as f:
              f.write("hoho")
  
      with pytest.raises(OSError) as excinfo:
          with atomic_write(str(fname), overwrite=False) as f:
              f.write("haha")
  
      assert excinfo.value.errno == errno.EEXIST
  
      assert fname.read() == "hoho"
      assert len(tmpdir.listdir()) == 1
  
file_path: catboost/contrib/python/atomicwrites/py2/tests/test_atomicwrites.py
imports: import errno
  import os
  from atomicwrites import atomic_write
  import pytest
label_desc: Use image node_id 1 for calling a global function with example usage: test_atomic_write(tmpdir) without return types