Skip to content

Commit

Permalink
BUG: Fix Python 2.4 invalid class declaration and try..finally.
Browse files Browse the repository at this point in the history
In numpy/lib/tests/test_regression.py
  • Loading branch information
charris committed Nov 13, 2013
1 parent c002dc5 commit bf6ed03
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions numpy/lib/tests/test_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,16 @@ def test_nansum_with_boolean(self):
def test_py3_compat(self):
# gh-2561
# Test if the oldstyle class test is bypassed in python3
class C():
class C:
"""Old-style class in python2, normal class in python3"""
pass

out = open(os.devnull, 'w')
try:
np.info(C(), output=out)
except AttributeError:
raise AssertionError()
try:
np.info(C(), output=out)
except AttributeError:
raise AssertionError()
finally:
out.close()

Expand Down

0 comments on commit bf6ed03

Please sign in to comment.