public void HasExecuteError_Abort() { var client = new KernelClient(KernelManagerMock.Object, ChannelFactoryMock.Object); Assert.IsFalse(client.HasExecuteError()); client.StartChannels(); dynamic content = new System.Dynamic.ExpandoObject(); // Abort is considered deprecated as of Jupyter 5.1, but we are still going to ensure we handle it, in // case there is an older kernel we need to interact with. content.status = ExecuteStatus.Abort; client.ExecuteLog.Add("1", new ExecutionEntry() { Complete = true, ExecutionIndex = 1, Request = new Message(null), Response = new List <Message>() { new Message() { Content = content } } }); Assert.IsTrue(client.HasExecuteError()); }
public void HasExecuteError_NonStandardContent() { var client = new KernelClient(KernelManagerMock.Object, ChannelFactoryMock.Object); Assert.IsFalse(client.HasExecuteError()); client.StartChannels(); // The check expects an element named "status". We are going to have something different, // and even though it's set to the error of a value, it's not actually a status error so // the message should be flagged as okay. dynamic content = new System.Dynamic.ExpandoObject(); content.test = ExecuteStatus.Error; client.ExecuteLog.Add("1", new ExecutionEntry() { Complete = true, ExecutionIndex = 1, Request = new Message(null), Response = new List <Message>() { new Message() { Content = content } } }); Assert.IsFalse(client.HasExecuteError()); }
public void HasExecuteError_Empty() { var client = new KernelClient(KernelManagerMock.Object, ChannelFactoryMock.Object); Assert.IsFalse(client.HasExecuteError()); client.StartChannels(); Assert.IsFalse(client.HasExecuteError()); }
public void HasExecuteError_AbandonedCode() { var client = new KernelClient(KernelManagerMock.Object, ChannelFactoryMock.Object); Assert.IsFalse(client.HasExecuteError()); client.StartChannels(); client.ExecuteLog.Add("1", new ExecutionEntry() { Complete = false, Abandoned = true, ExecutionIndex = -1, Request = new Message(null) }); // If an execution request is flagged as abandoned, we consider that an error // situation and will stop. Assert.IsTrue(client.HasExecuteError()); }
public void HasExecuteError_MixedStatuses() { var client = new KernelClient(KernelManagerMock.Object, ChannelFactoryMock.Object); Assert.IsFalse(client.HasExecuteError()); client.StartChannels(); client.ExecuteLog.Add("1", new ExecutionEntry() { Complete = true, ExecutionIndex = 1, Request = new Message(null), Response = new List <Message>() { GetSuccessMessage(), GetErrorMessage(), GetErrorMessage(), GetSuccessMessage() } }); Assert.IsTrue(client.HasExecuteError()); }
public void GetExecuteErrors_AbandonedCode() { var client = new KernelClient(KernelManagerMock.Object, ChannelFactoryMock.Object); Assert.IsFalse(client.HasExecuteError()); client.StartChannels(); client.ExecuteLog.Add("1", new ExecutionEntry() { Complete = false, Abandoned = true, ExecutionIndex = -1, Request = new Message(null) }); Assert.AreEqual(1, client.GetExecuteErrors().Count); Assert.AreEqual(KernelClient.ABANDONED_CODE_ERROR_MESSAGE, client.GetExecuteErrors().First()); }
public void GetExecuteErrors_None() { var client = new KernelClient(KernelManagerMock.Object, ChannelFactoryMock.Object); Assert.IsFalse(client.HasExecuteError()); client.StartChannels(); client.ExecuteLog.Add("1", new ExecutionEntry() { Complete = true, ExecutionIndex = 1, Request = new Message(null), Response = new List <Message>() { GetErrorMessage(), GetErrorMessage() } }); Assert.AreEqual(0, client.GetExecuteErrors().Count); }
public void GetExecuteErrors_MultipleWithEmpty() { var client = new KernelClient(KernelManagerMock.Object, ChannelFactoryMock.Object); Assert.IsFalse(client.HasExecuteError()); client.StartChannels(); client.ExecuteLog.Add("1", new ExecutionEntry() { Complete = true, ExecutionIndex = 1, Request = new Message(null), Response = new List <Message>() { GetErrorMessage("Error message 1"), GetErrorMessage(), GetErrorMessage("Error message 2") } }); Assert.AreEqual(2, client.GetExecuteErrors().Count); Assert.AreEqual("TestError: Error message 1", client.GetExecuteErrors().First()); Assert.AreEqual("TestError: Error message 2", client.GetExecuteErrors().Last()); }