Skip to content

Commit 9f9bbbe

Browse files
committed
make test_with run on older python again
1 parent 2579826 commit 9f9bbbe

File tree

1 file changed

+9
-4
lines changed
  • graalpython/com.oracle.graal.python.test/src/tests

1 file changed

+9
-4
lines changed

graalpython/com.oracle.graal.python.test/src/tests/test_with.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
# Qunaibit 02/05/2014
2525
# With Statement
2626

27+
import sys
28+
2729
a = 5
2830

2931
LOG = []
@@ -211,13 +213,13 @@ def gen():
211213
e = None
212214
try:
213215
try:
214-
raise ModuleNotFoundError
215-
except ModuleNotFoundError as e1:
216+
raise OverflowError
217+
except OverflowError as e1:
216218
e = e1
217219
for i in gen():
218220
r.append(i)
219221
raise
220-
except ModuleNotFoundError as e2:
222+
except OverflowError as e2:
221223
assert e2 is e
222224
else:
223225
assert False
@@ -240,7 +242,10 @@ class X():
240242
with x as l:
241243
pass
242244
except AttributeError as e:
243-
assert "__enter__" in str(e)
245+
if sys.version_info.minor > 5:
246+
assert "__enter__" in str(e)
247+
else:
248+
assert "__exit__" in str(e)
244249

245250

246251
y_enter_called = 0

0 commit comments

Comments
 (0)