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 the correct error messages are raised while executing:
    with method(*args):
        func()
  *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","the","correct","error","messages","are","raised","while","executing",":","with","method","(","*","args",")",":","func","(",")","*","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 assertMessagesCM(self, methodName, args, func, errors):
      """
      Check that the correct error messages are raised while executing:
        with method(*args):
            func()
      *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;
      """
      p = product(
          (self.testableFalse, self.testableTrue), ({}, {"msg": "oops"})
      )
      for (cls, kwargs), err in zip(p, errors):
          method = getattr(cls, methodName)
          with self.assertRaisesRegex(cls.failureException, err):
              with method(*args, **kwargs) as cm:
                  func()
  
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 28 for calling the TestLongMessage obj's underlying member method code with example usage: obj.assertMessagesCM(methodName, args, func, errors) without return types