Skip to content

Commit

Permalink
Fixed bug in assert statement
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaume committed Mar 2, 2012
1 parent c55598d commit 4736a57
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pyc2py.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def delete_statements(self, match, rec = False):
def write(self, indent = ''):
self.replace_statements(
match = lambda s: isinstance(s, If) and len(s.statements) == 1 and isinstance(s.statements[0], Raise) and s.statements[0].exception == Variable('AssertionError'),
new = lambda s: Assert(s.expr if isinstance(s.expr, UnaryOp) and s.expr.op == 'not ' else UnaryOp('not ', s.expr), s.statements[0].param)
new = lambda s: Assert(s.expr.expr if isinstance(s.expr, UnaryOp) and s.expr.op == 'not ' else UnaryOp('not ', s.expr), s.statements[0].param)
)
if len(self.statements) == 0:
self.append_statement(Pass())
Expand Down

0 comments on commit 4736a57

Please sign in to comment.