Skip to content

Commit

Permalink
Fix parsing crashes when tests include with statements
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewminer committed Jan 3, 2020
1 parent 0a2c83e commit f620fac
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions mamba/nodetransformers.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,15 @@ def _get_name(self, node):

if isinstance(context_expr, ast.Call):
if hasattr(context_expr.func, 'value'):
return context_expr.func.value.id
return context_expr.func.id
if hasattr(context_expr.func.value, 'id'):
return context_expr.func.value.id

if hasattr(context_expr.func, 'id'):
return context_expr.func.id

if isinstance(context_expr, ast.Attribute):
return context_expr.value.id
if hasattr(context_expr.value, 'id'):
return context_expr.value.id

def _context_expr_for(self, node):
return node.context_expr
Expand Down

0 comments on commit f620fac

Please sign in to comment.