diff options
author | Georg Brandl <georg@python.org> | 2007-08-21 06:01:18 +0000 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2007-08-21 06:01:18 +0000 |
commit | fdca6d8599e46ee7fc7844a798666fc60923fbe5 (patch) | |
tree | 238caa41f0e2edce919e55b1d658330415036caa /Lib/test/test_exceptions.py | |
parent | 1bb124ad0d9a81664170d9a41c6c8128ceafbc33 (diff) | |
download | cpython-git-fdca6d8599e46ee7fc7844a798666fc60923fbe5.tar.gz |
Demand version 2.5.1 since 2.5 has a bug with codecs.open context managers.
Diffstat (limited to 'Lib/test/test_exceptions.py')
-rw-r--r-- | Lib/test/test_exceptions.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py index 657cbc5327..2f57f3df50 100644 --- a/Lib/test/test_exceptions.py +++ b/Lib/test/test_exceptions.py @@ -9,6 +9,16 @@ from test.test_support import (TESTFN, unlink, run_unittest, catch_warning) from test.test_pep352 import ignore_message_warning +class NaiveException(Exception): + def __init__(self, x): + self.x = x + +class SomewhatNaiveException(Exception): + def __init__(self, x): + self.x = x + Exception.__init__(self) + + # XXX This is not really enough, each *operation* should be tested! class ExceptionTests(unittest.TestCase): @@ -263,6 +273,10 @@ class ExceptionTests(unittest.TestCase): {'message' : '', 'args' : (u'\u3042', 0, 1, 'ouch'), 'object' : u'\u3042', 'reason' : 'ouch', 'start' : 0, 'end' : 1}), + (NaiveException, ('foo',), + {'message': '', 'args': ('foo',), 'x': 'foo'}), + (SomewhatNaiveException, ('foo',), + {'message': '', 'args': (), 'x': 'foo'}), ] try: exceptionList.append( @@ -283,7 +297,8 @@ class ExceptionTests(unittest.TestCase): if type(e) is not exc: raise # Verify module name - self.assertEquals(type(e).__module__, 'exceptions') + if not type(e).__name__.endswith('NaiveException'): + self.assertEquals(type(e).__module__, 'exceptions') # Verify no ref leaks in Exc_str() s = str(e) for checkArgName in expected: |