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