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
Surface.test_get_abs_parent and Surface.test_get_abs_offset tests, and fix. #1900
Conversation
I just saw that the display.quit bug has been resolved, but my point still stands: I think it makes sense to have a different unit test for that. If i'm wrong, I'll add to this and the get_bitsize unit tests as you'd like. |
I think we probably need to test it for every (32 of them) functions that include the assert as it is right now - mainly because it is written into the code 32 separate times and at any time somebody could remove or accidentally break one of those code blocks and break that particular function while leaving the others intact. This sort of thing is why the unit tests have sat undone for a long time I expect. |
Hey, sooo, the problem got fixed with get_bitsize. I just pushed the updated test for that, but get_abs_parent() and get_abs_offset() still don't raise an error.
prints
|
Are these methods supposed to have the same checks?
|
Huh, looks like that's because these two are some of the few functions that don't raise this assert in surface.c. EDIT: I see you spotted that as I was typing... I feel like they should have this assert, since pretty much everything else in EDIT 2: I count 49 documented functions in the surface module and 37 instances of this assert being raised. So I guess it is potentially missing from 12 of these functions. Though perhaps some legitimately do still work after the display module has been quit... |
…), parent() unit tests and missing assertions to the actual methods.
I did the thing with some other related methods and their unit tests, too. Let me know if I went overboard, or the checks could be done more efficiently. |
I'm not sure, but did the tests fail because I'm supposed to declare variables first and then have expressions? If so, is there anything I can use to check before pushing? I don't remember seeing anything like that in contribution guide |
That is a weird python 2 only thing, that probably should be written up somewhere in a tips section for writing C Python code. I recall discovering it in the same way. |
I just searched for fails and errors and this is the only thing I could find. |
Yes that is another new unit test added this week that has variable accuracy on Continuous Integration which it seems we are still trying to nail down. |
I guess that means that I'll have to wait for that one. |
Where are you seeing syntax errors reported? Is it on one of the CI builds you could link me to? |
Jesus christ, I think I somehow mistook my own commit message for the build error. |
CI for this test should be fixed by this PR: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Thanks for this :) |
Wrote unit tests as per issues #1797 and #1798
Did I need to write the display.quit case as in #1898 ?
Because if so, at that point, wouldn't it make sense to have a different unit test just for display.quit case and just test there? The discussions of that bug would also be in a single (new)issue and it would be more convenient.