diff options
author | Finn Bock <bckfnn@worldonline.dk> | 2001-12-08 10:15:48 (GMT) |
---|---|---|
committer | Finn Bock <bckfnn@worldonline.dk> | 2001-12-08 10:15:48 (GMT) |
commit | aa3dc456583aaffcccc16da82bb68669264880b4 (patch) | |
tree | a19b09671164f773dd75986b3d0ba8b5db0dec82 /Lib/test/test_exceptions.py | |
parent | 59d5a9b5b7db3c84435d80224a825b8133654273 (diff) | |
download | cpython-aa3dc456583aaffcccc16da82bb68669264880b4.zip cpython-aa3dc456583aaffcccc16da82bb68669264880b4.tar.gz cpython-aa3dc456583aaffcccc16da82bb68669264880b4.tar.bz2 |
Enable support for jython:
1. Acknowledge the welknown difference that jython
allows continue in the finally clause.
2. Avoid using _testcapi when running with jython.
This closes patch "[ #490417 ] Jython and test_exceptions"
Diffstat (limited to 'Lib/test/test_exceptions.py')
-rw-r--r-- | Lib/test/test_exceptions.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py index d194c8b..e03abfa 100644 --- a/Lib/test/test_exceptions.py +++ b/Lib/test/test_exceptions.py @@ -4,7 +4,6 @@ from test_support import * from types import ClassType import warnings import sys, traceback -import _testcapi warnings.filterwarnings("error", "", OverflowWarning, __name__) @@ -121,7 +120,11 @@ while 1: finally: continue ''' -ckmsg(s, "'continue' not supported inside 'finally' clause") +if sys.platform.startswith('java'): + print "'continue' not supported inside 'finally' clause" + print "ok" +else: + ckmsg(s, "'continue' not supported inside 'finally' clause") s = '''\ try: continue @@ -171,6 +174,7 @@ class BadException: raise RuntimeError, "can't instantiate BadException" def test_capi1(): + import _testcapi try: _testcapi.raise_exception(BadException, 1) except TypeError, err: @@ -180,9 +184,9 @@ def test_capi1(): assert co.co_filename.endswith('test_exceptions.py') else: print "Expected exception" -test_capi1() def test_capi2(): + import _testcapi try: _testcapi.raise_exception(BadException, 0) except RuntimeError, err: @@ -194,6 +198,9 @@ def test_capi2(): assert co2.co_name == "test_capi2" else: print "Expected exception" -test_capi2() + +if not sys.platform.startswith('java'): + test_capi1() + test_capi2() unlink(TESTFN) |