Simplify a FormattedExcinfo test

The previous test was better in that it used fakes to test all of the
real code paths. The problem with that is that it makes it impossible to
simplify the code with `isinstance` checks. So let's just simulate the
issue directly with a monkeypatch.
This commit is contained in:
Ran Benita
2019-11-16 12:53:49 +02:00
parent e3ac44df36
commit 307add025b
2 changed files with 9 additions and 58 deletions

View File

@@ -283,8 +283,6 @@ class Traceback(list):
access to Traceback entries.
"""
Entry = TracebackEntry
def __init__(self, tb, excinfo=None):
""" initialize from given python traceback object and ExceptionInfo """
self._excinfo = excinfo
@@ -292,7 +290,7 @@ class Traceback(list):
def f(cur):
while cur is not None:
yield self.Entry(cur, excinfo=excinfo)
yield TracebackEntry(cur, excinfo=excinfo)
cur = cur.tb_next
list.__init__(self, f(tb))