docstr: Test PyUnicode_DecodeUTF8()
docstr_tok: ["Test","PyUnicode_DecodeUTF8","(",")"]
code: def test_decodeutf32(self):
      """Test PyUnicode_DecodeUTF8()"""
      decodeutf32 = _testcapi.unicode_decodeutf32
  
      naturalbyteorder = -1 if sys.byteorder == "little" else 1
      for s in ["abc", "\xa1\xa2", "\u4f60\u597d", "a\U0001f600"]:
          b = s.encode("utf-32")
          self.assertEqual(decodeutf32(0, b), (naturalbyteorder, s))
          b = s.encode("utf-32le")
          self.assertEqual(decodeutf32(-1, b), (-1, s))
          self.assertEqual(
              decodeutf32(0, b"\xff\xfe\x00\x00" + b), (-1, s)
          )
          b = s.encode("utf-32be")
          self.assertEqual(decodeutf32(1, b), (1, s))
          self.assertEqual(
              decodeutf32(0, b"\x00\x00\xfe\xff" + b), (1, s)
          )
  
      self.assertRaises(
          UnicodeDecodeError, decodeutf32, -1, b"\x61\x00\x00\x00\x00"
      )
      self.assertRaises(
          UnicodeDecodeError, decodeutf32, 1, b"\x00\x00\x00\x61\x00"
      )
      self.assertRaises(
          UnicodeDecodeError,
          decodeutf32,
          0,
          b"\xff\xfe\x00\x00\x61\x00\x00\x00\x00",
      )
      self.assertRaises(
          UnicodeDecodeError,
          decodeutf32,
          0,
          b"\x00\x00\xfe\xff\x00\x00\x00\x61\x00",
      )
  
      self.assertRaises(
          UnicodeDecodeError, decodeutf32, -1, b"\xff\xff\xff\xff"
      )
      self.assertRaises(
          UnicodeDecodeError, decodeutf32, 1, b"\xff\xff\xff\xff"
      )
      self.assertRaises(
          UnicodeDecodeError, decodeutf32, 0, b"\xff\xff\xff\xff"
      )
      self.assertEqual(
          decodeutf32(-1, b"\xff\xff\xff\xff", "replace"),
          (-1, "\ufffd"),
      )
      self.assertEqual(
          decodeutf32(1, b"\xff\xff\xff\xff", "replace"), (1, "\ufffd")
      )
      self.assertEqual(
          decodeutf32(0, b"\xff\xff\xff\xff", "replace"), (0, "\ufffd")
      )
      self.assertEqual(
          decodeutf32(
              0, b"\xff\xfe\x00\x00\xff\xff\xff\xff", "replace"
          ),
          (-1, "\ufffd"),
      )
      self.assertEqual(
          decodeutf32(
              0, b"\x00\x00\xfe\xff\xff\xff\xff\xff", "replace"
          ),
          (1, "\ufffd"),
      )
  
      self.assertRaises(
          UnicodeDecodeError, decodeutf32, -1, b"\x3d\xd8\x00\x00"
      )
      self.assertEqual(
          decodeutf32(-1, b"\x3d\xd8\x00\x00", "replace"),
          (-1, "\ufffd"),
      )
      self.assertRaises(
          UnicodeDecodeError, decodeutf32, 1, b"\x00\x00\xd8\x3d"
      )
      self.assertEqual(
          decodeutf32(1, b"\x00\x00\xd8\x3d", "replace"), (1, "\ufffd")
      )
  
      self.assertRaises(
          LookupError, decodeutf32, -1, b"\xff\xff\xff\xff", "foo"
      )
      self.assertRaises(
          LookupError, decodeutf32, 1, b"\xff\xff\xff\xff", "foo"
      )
      self.assertRaises(
          LookupError, decodeutf32, 0, b"\xff\xff\xff\xff", "foo"
      )
  
imports: import unittest
  import sys
  from test.support import import_helper
label_desc: Use image node_id 10 for calling the CAPITest obj's underlying member method code with example usage: obj.test_decodeutf32() without return types