code: def test_source_file_prefix_removal(self):
      def make_hlo():
          return module_to_string(
              jax.jit(jnp.sin).lower(jnp.arange(8.0)).compiler_ir()
          )
  
      # Sanity check
      self.assertRegex(make_hlo(), r"[/\\]+tests[/\\]+metadata_test.py")
  
      with jax_config.hlo_source_file_canonicalization_regex(
          r".*[\\/]+tests[/\\]+"
      ):
          hlo = make_hlo()
          self.assertIn("metadata_test.py", hlo)
          self.assertNotRegex(hlo, r"tests[/\\]+")
          self.assertNotRegex(hlo, r"[/\\]+metadata_test.py")
  
      with jax_config.hlo_source_file_canonicalization_regex(
          "no_match_xxx"
      ):
          hlo = make_hlo()
          self.assertRegex(hlo, r"[/\\]+tests[/\\]+metadata_test.py")
  
      with jax_config.hlo_source_file_canonicalization_regex(".*"):
          hlo = make_hlo()
          self.assertNotIn("test.py", hlo)
  
      with jax_config.hlo_source_file_canonicalization_regex("test"):
          hlo = make_hlo()
          self.assertRegex(hlo, r"[/\\]+s[/\\]+metadata_.py")
  
file_path: jax/tests/metadata_test.py
imports: import io
  import unittest
  from absl.testing import absltest
  from jax._src import test_util
  import jax
  from jax._src import config
  from jax._src.lib.mlir import ir
  from jax import numpy
  from jax import config
label_desc: Use image node_id 5 for calling the MetadataTest obj's underlying member method code with example usage: obj.test_source_file_prefix_removal() and returns: module_to_string