class_docstr: Test that the individual asserts honour longMessage.
  This actually tests all the message behaviour for
  asserts that use longMessage.
class_docstr_tok: ["Test","that","the","individual","asserts","honour","longMessage",".","This","actually","tests","all","the","message","behaviour","for","asserts","that","use","longMessage","."]
docstr: Check that methodName(*args) raises the correct error messages.
  errors should be a list of 4 regex that match the error when:
    1) longMessage = False and no msg passed;
    2) longMessage = False and msg passed;
    3) longMessage = True and no msg passed;
    4) longMessage = True and msg passed;
docstr_tok: ["Check","that","methodName","(","*","args",")","raises","the","correct","error","messages",".","errors","should","be","a","list","of","4","regex","that","match","the","error","when",":","1",")","longMessage","=","False","and","no","msg","passed",";","2",")","longMessage","=","False","and","msg","passed",";","3",")","longMessage","=","True","and","no","msg","passed",";","4",")","longMessage","=","True","and","msg","passed",";"]
code: def assertMessages(self, methodName, args, errors):
      """
      Check that methodName(*args) raises the correct error messages.
      errors should be a list of 4 regex that match the error when:
        1) longMessage = False and no msg passed;
        2) longMessage = False and msg passed;
        3) longMessage = True and no msg passed;
        4) longMessage = True and msg passed;
      """
  
      def getMethod(i):
          useTestableFalse = i < 2
          if useTestableFalse:
              test = self.testableFalse
          else:
              test = self.testableTrue
          return getattr(test, methodName)
  
      for i, expected_regex in enumerate(errors):
          testMethod = getMethod(i)
          kwargs = {}
          withMsg = i % 2
          if withMsg:
              kwargs = {"msg": "oops"}
  
          with self.assertRaisesRegex(
              self.failureException, expected_regex=expected_regex
          ):
              testMethod(*args, **kwargs)
  
imports: import datetime
  import warnings
  import weakref
  import unittest
  from test.support import gc_collect
  from itertools import product
label_desc: Use image node_id 5 for calling the TestLongMessage obj's underlying member method code with example usage: obj.assertMessages(methodName, args, errors) and returns: getattr