Skip to content

Commit

Permalink
Fix assertion and invalid function call
Browse files Browse the repository at this point in the history
  • Loading branch information
BergLucas committed Jun 6, 2024
1 parent c7e4419 commit 46475da
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/pynguin/analyses/syntaxtree.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def context(self) -> _Context:
def visit_Raise(self, node: ast.Raise) -> ast.AST: # noqa: N802
bubbles = self.context.add_exception(node)
if bubbles:
assert len(self.contexts) > 1
assert len(self.contexts) >= 1
if len(self.contexts) < 2:
return self.generic_visit(node)
parent_context = self.contexts[-2]
Expand Down Expand Up @@ -378,7 +378,11 @@ def visit_Assert(self, node: ast.Assert) -> ast.AST: # noqa: N802
# exceptions.
self.visit_Raise(
ast.Raise(
exc=ast.Call(func=ast.Name(id="AssertionError", ctx=ast.Load())),
exc=ast.Call(
func=ast.Name(id="AssertionError", ctx=ast.Load()),
args=[],
keywords=[],
),
)
)
# Make sure that we also execute a visit_Assert method in another analysis
Expand Down

0 comments on commit 46475da

Please sign in to comment.