docstr: Test PyUnicode_FindChar()
docstr_tok: ["Test","PyUnicode_FindChar","(",")"]
code: def test_findchar(self):
      """Test PyUnicode_FindChar()"""
      from _testcapi import unicode_findchar
  
      for str in (
          "\xa1",
          "\u8000\u8080",
          "\ud800\udc02",
          "\U0001f100\U0001f1f1",
      ):
          for i, ch in enumerate(str):
              self.assertEqual(
                  unicode_findchar(str, ord(ch), 0, len(str), 1), i
              )
              self.assertEqual(
                  unicode_findchar(str, ord(ch), 0, len(str), -1), i
              )
  
      str = "!>_<!"
      self.assertEqual(
          unicode_findchar(str, 0x110000, 0, len(str), 1), -1
      )
      self.assertEqual(
          unicode_findchar(str, 0x110000, 0, len(str), -1), -1
      )
      # start < end
      self.assertEqual(
          unicode_findchar(str, ord("!"), 1, len(str) + 1, 1), 4
      )
      self.assertEqual(
          unicode_findchar(str, ord("!"), 1, PY_SSIZE_T_MAX, 1), 4
      )
      self.assertEqual(
          unicode_findchar(str, ord("!"), 0, len(str) + 1, -1), 4
      )
      self.assertEqual(
          unicode_findchar(str, ord("!"), 0, PY_SSIZE_T_MAX, -1), 4
      )
      # start >= end
      self.assertEqual(unicode_findchar(str, ord("!"), 0, 0, 1), -1)
      self.assertEqual(unicode_findchar(str, ord("!"), 0, 0, -1), -1)
      self.assertEqual(
          unicode_findchar(str, ord("!"), len(str), 0, 1), -1
      )
      self.assertEqual(
          unicode_findchar(str, ord("!"), len(str), 0, -1), -1
      )
      # negative
      self.assertEqual(
          unicode_findchar(str, ord("!"), -len(str), -1, 1), 0
      )
      self.assertEqual(
          unicode_findchar(str, ord("!"), -len(str), -1, -1), 0
      )
      self.assertEqual(
          unicode_findchar(str, ord("!"), PY_SSIZE_T_MIN, -1, 1), 0
      )
      self.assertEqual(
          unicode_findchar(str, ord("!"), PY_SSIZE_T_MIN, -1, -1), 0
      )
      self.assertEqual(
          unicode_findchar(
              str, ord("!"), PY_SSIZE_T_MIN, PY_SSIZE_T_MAX, 1
          ),
          0,
      )
      self.assertEqual(
          unicode_findchar(
              str, ord("!"), PY_SSIZE_T_MIN, PY_SSIZE_T_MAX, -1
          ),
          4,
      )
  
imports: import unittest
  import sys
  from test import support
  from test.support import import_helper
label_desc: Use image node_id 38 for calling the CAPITest obj's underlying member method code with example usage: obj.test_findchar() without return types