Test assert if __debug__ is true.

This commit is contained in:
Georg Brandl 2006-10-29 09:18:00 +00:00
parent 3354f285b9
commit facd273198
1 changed files with 3 additions and 4 deletions

View File

@ -544,10 +544,9 @@ hello world
assert 0, "msg"
except AssertionError, e:
self.assertEquals(e.args[0], "msg")
# we can not expect an assertion error to be raised
# if the tests are run in an optimized python
#else:
# self.fail("AssertionError not raised by assert 0")
else:
if __debug__:
self.fail("AssertionError not raised by assert 0")
### compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | funcdef | classdef
# Tested below