def testModelCommandResultSerializableStateWithNonZeroStatus(self): commandID = 1 method = "testMethod" status = 1 errorMessage = "something bad happened" commandResult = ModelCommandResult(commandID=commandID, method=method, status=status, errorMessage=errorMessage) self.assertEqual(commandResult.commandID, commandID) self.assertEqual(commandResult.method, method) self.assertEqual(commandResult.status, status) self.assertEqual(commandResult.errorMessage, errorMessage) self.assertIsNone(commandResult.args) self.assertIn("ModelCommandResult<", str(commandResult)) self.assertIn("ModelCommandResult<", repr(commandResult)) commandResult2 = _ModelRequestResultBase.__createFromState__( commandResult.__getstate__()) self.assertEqual(commandResult2.commandID, commandID) self.assertEqual(commandResult2.method, method) self.assertEqual(commandResult2.status, status) self.assertEqual(commandResult2.errorMessage, errorMessage) self.assertIsNone(commandResult2.args) self.assertIn("ModelCommandResult<", str(commandResult2)) self.assertIn("ModelCommandResult<", repr(commandResult2))
def _implModelCommandResultSerializableStateWithZeroStatus(self, args): commandID = 1 method = "testMethod" status = 0 commandResult = ModelCommandResult(commandID=commandID, method=method, status=status, args=copy.copy(args)) self.assertEqual(commandResult.commandID, commandID) self.assertEqual(commandResult.method, method) self.assertEqual(commandResult.status, status) self.assertEqual(commandResult.args, args) self.assertIsNone(commandResult.errorMessage) commandResult2 = _ModelRequestResultBase.__createFromState__( commandResult.__getstate__()) self.assertEqual(commandResult2.commandID, commandID) self.assertEqual(commandResult2.method, method) self.assertEqual(commandResult2.status, status) self.assertEqual(commandResult2.args, args) self.assertIsNone(commandResult2.errorMessage) self.assertIn("ModelCommandResult<", str(commandResult2)) self.assertIn("ModelCommandResult<", repr(commandResult2))