Skip to content

Commit

Permalink
Tests for try: import badcode except: pass, #592
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielKluev committed Apr 23, 2011
1 parent 9f5e275 commit a6a98c2
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
20 changes: 20 additions & 0 deletions examples/libtest/CompileTest.py
Expand Up @@ -55,3 +55,23 @@ def test_subscript_tuple(self):
x = d[1,2]
"""
self.fail("Tuple subscripts issue #496")

def test_bad_import(self):
try: import _nonexistentmodule
except: pass

try: import _importtimeerror
except: pass

"""
try: import _badsyntaxmodule
except: pass
"""
self.fail("try: import badcode/except does not catch SyntaxError, #592")

"""
try: import _untranslatablemodule
except: pass
"""
self.fail("try: import badcode/except does not catch TranslationError, #592")

5 changes: 5 additions & 0 deletions examples/libtest/_badsyntaxmodule.py
@@ -0,0 +1,5 @@
"""
Test module with syntax error, for import compilation/linking testing
"""

(((
4 changes: 4 additions & 0 deletions examples/libtest/_importtimeerror.py
@@ -0,0 +1,4 @@
"""
Test module with import-time exception, for import compilation/linking testing
"""
raise Exception("Testing import-time exception")
4 changes: 4 additions & 0 deletions examples/libtest/_untranslatablemodule.py
@@ -0,0 +1,4 @@
"""
Test module with unsupported by translator syntax, for import compilation/linking testing
"""
[1,2,3,4][::]

0 comments on commit a6a98c2

Please sign in to comment.