docstr: Test PyUnicode_CopyCharacters()
docstr_tok: ["Test","PyUnicode_CopyCharacters","(",")"]
code: def test_copycharacters(self):
      """Test PyUnicode_CopyCharacters()"""
      from _testcapi import unicode_copycharacters
  
      strings = [
          # all strings have exactly 5 characters
          "abcde",
          "\xa1\xa2\xa3\xa4\xa5",
          "\u4f60\u597d\u4e16\u754c\uff01",
          "\U0001f600\U0001f601\U0001f602\U0001f603\U0001f604",
      ]
  
      for idx, from_ in enumerate(strings):
          # wide -> narrow: exceed maxchar limitation
          for to in strings[:idx]:
              self.assertRaises(
                  SystemError,
                  unicode_copycharacters,
                  to,
                  0,
                  from_,
                  0,
                  5,
              )
          # same kind
          for from_start in range(5):
              self.assertEqual(
                  unicode_copycharacters(
                      from_, 0, from_, from_start, 5
                  ),
                  (
                      from_[from_start : from_start + 5].ljust(5, "\0"),
                      5 - from_start,
                  ),
              )
          for to_start in range(5):
              self.assertEqual(
                  unicode_copycharacters(
                      from_, to_start, from_, to_start, 5
                  ),
                  (
                      from_[to_start : to_start + 5].rjust(5, "\0"),
                      5 - to_start,
                  ),
              )
          # narrow -> wide
          # Tests omitted since this creates invalid strings.
  
      s = strings[0]
      self.assertRaises(
          IndexError, unicode_copycharacters, s, 6, s, 0, 5
      )
      self.assertRaises(
          IndexError, unicode_copycharacters, s, PY_SSIZE_T_MAX, s, 0, 5
      )
      self.assertRaises(
          IndexError, unicode_copycharacters, s, -1, s, 0, 5
      )
      self.assertRaises(
          IndexError, unicode_copycharacters, s, PY_SSIZE_T_MIN, s, 0, 5
      )
      self.assertRaises(
          IndexError, unicode_copycharacters, s, 0, s, 6, 5
      )
      self.assertRaises(
          IndexError, unicode_copycharacters, s, 0, s, PY_SSIZE_T_MAX, 5
      )
      self.assertRaises(
          IndexError, unicode_copycharacters, s, 0, s, -1, 5
      )
      self.assertRaises(
          IndexError, unicode_copycharacters, s, 0, s, PY_SSIZE_T_MIN, 5
      )
      self.assertRaises(
          SystemError, unicode_copycharacters, s, 1, s, 0, 5
      )
      self.assertRaises(
          SystemError,
          unicode_copycharacters,
          s,
          1,
          s,
          0,
          PY_SSIZE_T_MAX,
      )
      self.assertRaises(
          SystemError, unicode_copycharacters, s, 0, s, 0, -1
      )
      self.assertRaises(
          SystemError,
          unicode_copycharacters,
          s,
          0,
          s,
          0,
          PY_SSIZE_T_MIN,
      )
      self.assertRaises(
          SystemError, unicode_copycharacters, s, 0, b"", 0, 0
      )
      self.assertRaises(
          SystemError, unicode_copycharacters, s, 0, [], 0, 0
      )
  
imports: import unittest
  import sys
  from test import support
  from test.support import import_helper
label_desc: Use image node_id 48 for calling the CAPITest obj's underlying member method code with example usage: obj.test_copycharacters() without return types