-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
self passed to class methods in Python 3 #22
Comments
Thanks for reporting the issue, I noticed it as well. Just to make sure, because of this issue, does it mean I can't use Auger with python 3? Or does it just concern a few edge cases? |
At the moment, you would have to post-process the output so that you instantiate the object first. You could try find & replacing "UpperObject." with "UpperObject()", and then "self=<[^>]+>" with nothing. Another option would be moving the method out of a class. This may or may not be possible with your existing code base. Traditional functions shouldn't be affected by this bug. See sample/gentests.py and sample/functions.py for an example on how you would set this up. I'll take a look at this this afternoon. Hopefully we'll be able to get this sorted out for you quickly. |
I took at look at this quickly, and unfortunately there doesn't seem to be a quick fix that I can see at the moment. Auger under Python 2 generates the following information for your function:
While under Python 3, it generates:
So it looks like Python 3 handles things a bit differently when it comes to inspecting code. I'll continue to poke about. |
Thank you for investigating this. What's the problem with what python 3 returns? I'm probably over looking that, but why not fix the code used for inspection to make sure it returns what python 2 was returning? |
That's the idea. What I posted above was to show why the behaviour between python 2 and 3 is different. |
Ok, I think I know what the underlying issue is. Python 3 removed unbound methods, which our code was expecting. |
Hi there, just wanted to see if there are any updates on fixing this issue? I'd really like to use this in a project, but using Python2 is somewhat limiting as I mostly use Python3. |
The test case provided by @JPFrancoia in issue #20 demonstrates a change in behaviour between Python 2 and 3.
In Python 2, the generated test case is:
While in Python 3, it is generated as:
Notice that self has been passed into UpperObject.parse in the test case generated by Python 3. This should be investigated, as this unit test will not run.
The text was updated successfully, but these errors were encountered: