Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Check the stacktrace format in the unit test
  • Loading branch information
filmor committed Jan 29, 2021
commit 1ab234a2ab4316d2398a87f5199de9228022ef05
16 changes: 15 additions & 1 deletion src/embed_tests/TestPythonException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,21 @@ public void TestPythonExceptionFormat()
}
catch (PythonException ex)
{
Assert.That(ex.Format(), Does.Contain("Traceback").And.Contains("(most recent call last):").And.Contains("ValueError: Error!"));
// Console.WriteLine($"Format: {ex.Format()}");
// Console.WriteLine($"Stacktrace: {ex.StackTrace}");
Assert.That(
ex.Format(),
Does.Contain("Traceback")
.And.Contains("(most recent call last):")
.And.Contains("ValueError: Error!")
);

// Check that the stacktrace is properly formatted
Assert.That(
ex.StackTrace,
Does.Not.StartWith("[")
.And.Not.Contain("\\n")
);
}
}

Expand Down