code: def testDefaultParseValueFuzz(self, value):
      try:
          result = parser.DefaultParseValue(value)
      except TypeError:
          # It's OK to get a TypeError if the string has the null character.
          if "\x00" in value:
              return
          raise
      except MemoryError:
          if len(value) > 100:
              # This is not what we're testing.
              return
          raise
  
      try:
          uvalue = six.text_type(value)
          uresult = six.text_type(result)
      except UnicodeDecodeError:
          # This is not what we're testing.
          return
  
      # Check that the parsed value doesn't differ too much from the input.
      distance = Levenshtein.distance(uresult, uvalue)
      max_distance = (
          2
          + sum(  # Quotes or parenthesis can be implicit.
              c.isspace() for c in value
          )
          + value.count('"')
          + value.count("'")
          + 3 * (value.count(",") + 1)
          + 3 * (value.count(":"))  # 'a,' can expand to "'a', "
          + 2 * value.count("\\")  # 'a:' can expand to "'a': "
      )
      if "#" in value:
          max_distance += len(value) - value.index("#")
  
      if not isinstance(result, six.string_types):
          max_distance += value.count("0")  # Leading 0s are stripped.
  
      # Note: We don't check distance for dicts since item order can be changed.
      if "{" not in value:
          self.assertLessEqual(
              distance,
              max_distance,
              (distance, max_distance, uvalue, uresult),
          )
  
file_path: python-fire/fire/parser_fuzz_test.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from fire import parser
  from fire import testutils
  from hypothesis import example
  from hypothesis import given
  from hypothesis import settings
  from hypothesis import strategies
  import Levenshtein
  import six
label_desc: Use image node_id 1 for calling the ParserFuzzTest obj's underlying member method code with example usage: obj.testDefaultParseValueFuzz(value) without return types