def testCaseHasAttribute(testCase, attributeName):
    if hasattr(getattr(testCase, testCase._testMethodName), attributeName):
        return True
    if hasattr(testCase.__class__, attributeName):
        return True
    return False
Determine whether a unittest.TestCase has a given attribute.
dataset/ETHPy150Open ufora/ufora/ufora/test/UnitTestCommon.py/testCaseHasAttribute