se2p / pynguin

The PYthoN General UnIt Test geNerator is a test-generation tool for Python
https://www.pynguin.eu
MIT License
1.22k stars 74 forks source link

Fix assertion error when analyzing a sklearn module #72

Closed BergLucas closed 1 month ago

BergLucas commented 1 month ago

Hi,

This pull request fixes the bug I've explained in issue #71.

I'm pretty sure that the problem is just an error in the assertion because if len(self.contexts) > 1 at the line 322, then the condition len(self.contexts) < 2 in the if statement at line 323 will never be True since there is no integer x that verifies the proposition 1 < x < 2. I've added a = in the assertion to fix the bug.

I changed the other part of the code because while I was looking for the source of the bug, I often converted the AST to a string using the ast.unparse function and this function crashed because some of the arguments of the ast.Call node were missing. I'm pretty sure this is also a small bug.

Have a nice day!