code: def test_artifacts_cannot_be_overwritten(self):
      with tempfile.TemporaryDirectory() as d:
          pyfile_path = os.path.join(d, "my_pyfile.py")
          with open(pyfile_path, "w+") as f:
              f.write("my_func = lambda: 10")
  
          self.spark.addArtifacts(pyfile_path, pyfile=True)
  
          # Writing the same file twice is fine, and should not throw.
          self.spark.addArtifacts(pyfile_path, pyfile=True)
  
          with open(pyfile_path, "w+") as f:
              f.write("my_func = lambda: 11")
  
          with self.assertRaisesRegex(
              SparkConnectGrpcException,
              "\\(java.lang.RuntimeException\\) Duplicate Artifact",
          ):
              self.spark.addArtifacts(pyfile_path, pyfile=True)
  
imports: import hashlib
  import shutil
  import tempfile
  import unittest
  import os
  from pyspark.errors.exceptions.connect import SparkConnectGrpcException
  from pyspark.sql import SparkSession
  from pyspark.testing.connectutils import ReusedConnectTestCase, should_test_connect
  from pyspark.testing.utils import SPARK_HOME
  from pyspark import SparkFiles
  from pyspark.sql.functions import udf
label_desc: Use image node_id 3 for calling the ArtifactTestsMixin obj's underlying member method code with example usage: obj.test_artifacts_cannot_be_overwritten() without return types