docstr: Test PyUnicode_AsLatin1String()
docstr_tok: ["Test","PyUnicode_AsLatin1String","(",")"]
code: def test_aslatin1string(self):
      """Test PyUnicode_AsLatin1String()"""
      aslatin1string = _testcapi.unicode_aslatin1string
  
      self.assertEqual(aslatin1string("abc"), b"abc")
      self.assertEqual(aslatin1string("\xa1\xa2"), b"\xa1\xa2")
  
      self.assertRaises(UnicodeEncodeError, aslatin1string, "\u4f60")
      self.assertRaises(TypeError, aslatin1string, b"abc")
      self.assertRaises(TypeError, aslatin1string, [])
  
imports: import unittest
  import sys
  from test.support import import_helper
label_desc: Use image node_id 14 for calling the CAPITest obj's underlying member method code with example usage: obj.test_aslatin1string() without return types