diff options
Diffstat (limited to 'Lib/test/test_traceback.py')
-rw-r--r-- | Lib/test/test_traceback.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py index 96d85e2..72dc7af 100644 --- a/Lib/test/test_traceback.py +++ b/Lib/test/test_traceback.py @@ -7,7 +7,7 @@ import sys import unittest import re from test import support -from test.support import TESTFN, Error, captured_output, unlink, cpython_only +from test.support import TESTFN, Error, captured_output, unlink, cpython_only, ALWAYS_EQ from test.support.script_helper import assert_python_ok import textwrap @@ -887,6 +887,8 @@ class TestFrame(unittest.TestCase): # operator fallbacks to FrameSummary.__eq__. self.assertEqual(tuple(f), f) self.assertIsNone(f.locals) + self.assertNotEqual(f, object()) + self.assertEqual(f, ALWAYS_EQ) def test_lazy_lines(self): linecache.clearcache() @@ -1083,6 +1085,18 @@ class TestTracebackException(unittest.TestCase): self.assertEqual(exc_info[0], exc.exc_type) self.assertEqual(str(exc_info[1]), str(exc)) + def test_comparison(self): + try: + 1/0 + except Exception: + exc_info = sys.exc_info() + exc = traceback.TracebackException(*exc_info) + exc2 = traceback.TracebackException(*exc_info) + self.assertIsNot(exc, exc2) + self.assertEqual(exc, exc2) + self.assertNotEqual(exc, object()) + self.assertEqual(exc, ALWAYS_EQ) + def test_unhashable(self): class UnhashableException(Exception): def __eq__(self, other): |