-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for finally clause and reraising.
whitequark
committed
Jul 27, 2015
1 parent
a83e7e2
commit 2939d4f
Showing
20 changed files
with
281 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# RUN: %python -m artiq.compiler.testbench.jit %s >%t | ||
# RUN: OutputCheck %s --file-to-check=%t | ||
# REQUIRES: exceptions | ||
|
||
def f(): | ||
try: | ||
1/0 | ||
finally: | ||
print("f-fin") | ||
print("f-out") | ||
|
||
def g(): | ||
try: | ||
f() | ||
except: | ||
print("g-except") | ||
|
||
# CHECK-L: f-fin | ||
# CHECK-NOT-L: f-out | ||
# CHECK-L: g-except | ||
g() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# RUN: %python -m artiq.compiler.testbench.jit %s >%t | ||
# RUN: OutputCheck %s --file-to-check=%t | ||
# REQUIRES: exceptions | ||
|
||
def f(): | ||
try: | ||
1/0 | ||
except: | ||
print("f-except") | ||
finally: | ||
print("f-fin") | ||
print("f-out") | ||
|
||
# CHECK-L: f-except | ||
# CHECK-L: f-fin | ||
# CHECK-L: f-out | ||
f() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# RUN: %python -m artiq.compiler.testbench.jit %s >%t | ||
# RUN: OutputCheck %s --file-to-check=%t | ||
# REQUIRES: exceptions | ||
|
||
def f(): | ||
try: | ||
1/0 | ||
finally: | ||
print("f-fin") | ||
raise ValueError() | ||
|
||
def g(): | ||
try: | ||
f() | ||
except ZeroDivisionError: | ||
print("g-except-zde") | ||
except ValueError: | ||
print("g-except-ve") | ||
|
||
# CHECK-L: f-fin | ||
# CHECK-L: g-except-ve | ||
# CHECK-NOT-L: g-except-zde | ||
g() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# RUN: %python -m artiq.compiler.testbench.jit %s >%t | ||
# RUN: OutputCheck %s --file-to-check=%t | ||
# REQUIRES: exceptions | ||
|
||
def f(): | ||
try: | ||
1/0 | ||
finally: | ||
print("f-fin") | ||
return | ||
|
||
def g(): | ||
try: | ||
f() | ||
except: | ||
print("g-except") | ||
|
||
# CHECK-L: f-fin | ||
# CHECK-NOT-L: f-out | ||
# CHECK-NOT-L: g-except | ||
g() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# RUN: %not %python -m artiq.compiler.testbench.jit %s >%t | ||
# RUN: OutputCheck %s --file-to-check=%t | ||
# REQUIRES: exceptions | ||
|
||
def f(): | ||
# CHECK-L: Uncaught ZeroDivisionError | ||
# CHECK-L: at input.py:${LINE:+1}: | ||
1/0 | ||
|
||
def g(): | ||
try: | ||
f() | ||
except: | ||
raise | ||
|
||
g() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# RUN: %not %python -m artiq.compiler.testbench.jit %s >%t | ||
# RUN: OutputCheck %s --file-to-check=%t | ||
# REQUIRES: exceptions | ||
|
||
def f(): | ||
1/0 | ||
|
||
def g(): | ||
try: | ||
f() | ||
except Exception as e: | ||
# CHECK-L: Uncaught ZeroDivisionError | ||
# CHECK-L: at input.py:${LINE:+1}: | ||
raise e | ||
|
||
g() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
# RUN: %not %python -m artiq.compiler.testbench.jit %s | ||
# RUN: %not %python -m artiq.compiler.testbench.jit %s >%t | ||
# RUN: OutputCheck %s --file-to-check=%t | ||
# REQUIRES: exceptions | ||
|
||
# CHECK-L: Uncaught ZeroDivisionError: cannot divide by zero (0, 0, 0) | ||
# CHECK-L: at input.py:${LINE:+1}:0 | ||
# CHECK-L: at input.py:${LINE:+1}: | ||
1/0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters