docstr: Test PyUnicode_Tailmatch()
docstr_tok: ["Test","PyUnicode_Tailmatch","(",")"]
code: def test_tailmatch(self):
      """Test PyUnicode_Tailmatch()"""
      from _testcapi import unicode_tailmatch as tailmatch
  
      str = "ababahalamaha"
      self.assertEqual(tailmatch(str, "aba", 0, len(str), -1), 1)
      self.assertEqual(tailmatch(str, "aha", 0, len(str), 1), 1)
  
      self.assertEqual(tailmatch(str, "aba", 0, PY_SSIZE_T_MAX, -1), 1)
      self.assertEqual(
          tailmatch(str, "aba", -len(str), PY_SSIZE_T_MAX, -1), 1
      )
      self.assertEqual(
          tailmatch(str, "aba", PY_SSIZE_T_MIN, len(str), -1), 1
      )
      self.assertEqual(tailmatch(str, "aha", 0, PY_SSIZE_T_MAX, 1), 1)
      self.assertEqual(
          tailmatch(str, "aha", PY_SSIZE_T_MIN, len(str), 1), 1
      )
  
      self.assertEqual(tailmatch(str, "z", 0, len(str), 1), 0)
      self.assertEqual(tailmatch(str, "z", 0, len(str), -1), 0)
      self.assertEqual(tailmatch(str, "", 0, len(str), 1), 1)
      self.assertEqual(tailmatch(str, "", 0, len(str), -1), 1)
  
      self.assertEqual(tailmatch(str, "ba", 0, len(str) - 1, -1), 0)
      self.assertEqual(tailmatch(str, "ba", 1, len(str) - 1, -1), 1)
      self.assertEqual(tailmatch(str, "aba", 1, len(str) - 1, -1), 0)
      self.assertEqual(tailmatch(str, "ba", -len(str) + 1, -1, -1), 1)
      self.assertEqual(tailmatch(str, "ah", 0, len(str), 1), 0)
      self.assertEqual(tailmatch(str, "ah", 0, len(str) - 1, 1), 1)
      self.assertEqual(tailmatch(str, "ah", -len(str), -1, 1), 1)
  
      # bad arguments
      self.assertRaises(
          TypeError, tailmatch, str, ("aba", "aha"), 0, len(str), -1
      )
      self.assertRaises(
          TypeError, tailmatch, str, ("aba", "aha"), 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 36 for calling the CAPITest obj's underlying member method code with example usage: obj.test_tailmatch() without return types