code: def checkraises(self, exc, obj, methodname, *args, expected_msg=None):
      obj = self.fixtype(obj)
      # we don't fix the arguments, because UserString can't cope with it
      with self.assertRaises(exc) as cm:
          getattr(obj, methodname)(*args)
      self.assertNotEqual(str(cm.exception), "")
      if expected_msg is not None:
          self.assertEqual(str(cm.exception), expected_msg)
  
file_path: cpython/Lib/test/test_userstring.py
imports: import unittest
  from test import string_tests
  from collections import UserString
label_desc: Use image node_id 2 for calling the UserStringTest obj's underlying member method code with example usage: obj.checkraises(exc, obj, methodname) without return types