code: def test_replace_default_in_arg_description(self):
      # Standard docstring with default.
      desc_with_default = "`float`, *optional*, defaults to 2.0"
      self.assertEqual(
          replace_default_in_arg_description(desc_with_default, 2.0),
          "`float`, *optional*, defaults to 2.0",
      )
      self.assertEqual(
          replace_default_in_arg_description(desc_with_default, 1.0),
          "`float`, *optional*, defaults to 1.0",
      )
      self.assertEqual(
          replace_default_in_arg_description(
              desc_with_default, inspect._empty
          ),
          "`float`",
      )
  
      # Standard docstring with default but optional is not using the stars.
      desc_with_default_typo = "`float`, `optional`, defaults to 2.0"
      self.assertEqual(
          replace_default_in_arg_description(
              desc_with_default_typo, 2.0
          ),
          "`float`, *optional*, defaults to 2.0",
      )
      self.assertEqual(
          replace_default_in_arg_description(
              desc_with_default_typo, 1.0
          ),
          "`float`, *optional*, defaults to 1.0",
      )
  
      # If the default is None we do not erase the value in the docstring.
      self.assertEqual(
          replace_default_in_arg_description(desc_with_default, None),
          "`float`, *optional*, defaults to 2.0",
      )
      # If the default is None (and set as such in the docstring), we do not include it.
      desc_with_default = "`float`, *optional*, defaults to None"
      self.assertEqual(
          replace_default_in_arg_description(desc_with_default, None),
          "`float`, *optional*",
      )
      desc_with_default = "`float`, *optional*, defaults to `None`"
      self.assertEqual(
          replace_default_in_arg_description(desc_with_default, None),
          "`float`, *optional*",
      )
  
      # Operations are not replaced, but put in backtiks.
      desc_with_default = "`float`, *optional*, defaults to 1/255"
      self.assertEqual(
          replace_default_in_arg_description(
              desc_with_default, 1 / 255
          ),
          "`float`, *optional*, defaults to `1/255`",
      )
      desc_with_default = "`float`, *optional*, defaults to `1/255`"
      self.assertEqual(
          replace_default_in_arg_description(
              desc_with_default, 1 / 255
          ),
          "`float`, *optional*, defaults to `1/255`",
      )
  
      desc_with_optional = "`float`, *optional*"
      self.assertEqual(
          replace_default_in_arg_description(desc_with_optional, 2.0),
          "`float`, *optional*, defaults to 2.0",
      )
      self.assertEqual(
          replace_default_in_arg_description(desc_with_optional, 1.0),
          "`float`, *optional*, defaults to 1.0",
      )
      self.assertEqual(
          replace_default_in_arg_description(desc_with_optional, None),
          "`float`, *optional*",
      )
      self.assertEqual(
          replace_default_in_arg_description(
              desc_with_optional, inspect._empty
          ),
          "`float`",
      )
  
      desc_with_no_optional = "`float`"
      self.assertEqual(
          replace_default_in_arg_description(
              desc_with_no_optional, 2.0
          ),
          "`float`, *optional*, defaults to 2.0",
      )
      self.assertEqual(
          replace_default_in_arg_description(
              desc_with_no_optional, 1.0
          ),
          "`float`, *optional*, defaults to 1.0",
      )
      self.assertEqual(
          replace_default_in_arg_description(
              desc_with_no_optional, None
          ),
          "`float`, *optional*",
      )
      self.assertEqual(
          replace_default_in_arg_description(
              desc_with_no_optional, inspect._empty
          ),
          "`float`",
      )
  
file_path: transformers/tests/repo_utils/test_check_docstrings.py
imports: import inspect
  import os
  import sys
  import unittest
  from check_docstrings import get_default_description, replace_default_in_arg_description
label_desc: Use image node_id 1 for calling the CheckDostringsTested obj's underlying member method code with example usage: obj.test_replace_default_in_arg_description() without return types