def testAddError(self): """Check if error state is added""" unitTestMock = mock.Mock(spec=unittest.TestCase) errMock = mock.Mock() tr = _TestResult() tr.addError(unitTestMock, errMock) self.assertEqual(len(unitTestMock.mock_calls), 0) self.assertEqual(tr.err, errMock)
def testAddError(self): """test the error state is added.""" # preconditions unitTestMock = mock.Mock(spec=unittest.TestCase) errMock = mock.Mock() # overengineered but I can't understand the type used for err tr = _TestResult() # do test tr.addError(unitTestMock, errMock) self.assertTrue(len(unitTestMock.mock_calls) == 0) self.assertEqual(tr.err, errMock)
def testAddError(self): """test the error state is added.""" # preconditions unitTestMock = mock.Mock(spec=unittest.TestCase) errMock = mock.Mock( ) # overengineered but I can't understand the type used for err tr = _TestResult() # do test tr.addError(unitTestMock, errMock) self.assertTrue(len(unitTestMock.mock_calls) == 0) self.assertEqual(tr.err, errMock)
def testAddFailure(self): """test the failure state is added.""" """This test is alamost similar to testAddError because the code to test is the same. Probably the differenziacion would be based on passed data.""" # preconditions unitTestMock = mock.Mock(spec=unittest.TestCase) errMock = mock.Mock() # overengineered but I can't understand the type used for err tr = _TestResult() # do test tr.addError(unitTestMock, errMock) self.assertTrue(len(unitTestMock.mock_calls) == 0) self.assertEqual(tr.err, errMock)
def testAddFailure(self): """test the failure state is added.""" """This test is alamost similar to testAddError because the code to test is the same. Probably the differenziacion would be based on passed data.""" # preconditions unitTestMock = mock.Mock(spec=unittest.TestCase) errMock = mock.Mock( ) # overengineered but I can't understand the type used for err tr = _TestResult() # do test tr.addError(unitTestMock, errMock) self.assertTrue(len(unitTestMock.mock_calls) == 0) self.assertEqual(tr.err, errMock)
def testInit(self): """check if __init__ is correctly executed.""" runner = _TestResult() self.assertIsInstance(runner, unittest.result.TestResult) self.assertIsNone(runner.err)