def __init__(self, case): try: self._id = case.id() except AttributeError: pass self._short_description = case.shortDescription() self._str = str(case)
def serialize_test_case(case): base = { 'shortDescription': case.shortDescription(), 'repr': str(case) } try: base['id'] = case.id() except AttributeError: pass return base
def test_unrepresentable_shortDescription(self): class TC(unittest.TestCase): def __str__(self): # see issue 422 raise ValueError('simulate some mistake in this code') def runTest(self): pass case = nose.case.Test(TC()) self.assertEqual(case.shortDescription(), None)