Skip to content
Snippets Groups Projects
Commit fca3f92d authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

fix docs

parent d63f3ee2
No related branches found
No related tags found
No related merge requests found
## v2.0.22rc3
TBA
* fixes #21
## v2.0.22rc2
......
......@@ -232,9 +232,15 @@ class Traceback(object):
self.formatted_traceback = six.text_type(traceback.format_exc())
def pickle_to(self, stream):
"""Pickle self to target stream"""
pickle.dump(self, stream, pickle.HIGHEST_PROTOCOL)
def pickle(self):
"""Returns this instance, pickled"""
return pickle.dumps(self, pickle.HIGHEST_PROTOCOL)
bio = io.BytesIO()
self.pickle_to(bio)
return bio.getvalue()
def pretty_format(self):
"""
......
......@@ -25,6 +25,16 @@ class TestTraceback(unittest.TestCase):
self.assertTrue(p_fmt)
print(p_fmt)
def test_issue_21(self):
try:
loc = u'hello world'
raise ValueError(u'hello')
except ValueError:
tb = Traceback()
a = tb.pickle()
self.assertIsInstance(Traceback, pickle.loads(a))
def test_compression_happens(self):
try:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment