-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
Refactor: Replace '.func is' with 'isinstance()' for code quality #27339
base: master
Are you sure you want to change the base?
Refactor: Replace '.func is' with 'isinstance()' for code quality #27339
Conversation
Hi, I am the SymPy bot. I'm here to help you write a release notes entry. Please read the guide on how to write release notes. ❌ There was an issue with the release notes. Please do not close this pull request; instead edit the description after reading the guide on how to write release notes.
Click here to see the pull request description that was parsed.
|
Commit Author name added
fcc3319
to
722a7d3
Compare
These are actually semantic changes. Is this really a problem that needs fixing? |
It was a code quality suggestion, also it maintain the uniformity in code base for further linting ease. |
There is a code quality check that prohibits writing
sympy/sympy/testing/tests/test_code_quality.py Lines 248 to 249 in ad5f32f
Of course we do need some tests for .func itself in the test suite rather but I don't think that applies to any of the cases here that can use isinstance .
|
You might be right that it is fine in this case. But making sweeping (semantic) changes across the tests code to please a code linter will always run the risk of introducing unintended changes to the test cases. I personally would skip the entry in the release notes, since it's only affecting test files. (so the change is not user facing). After carefully looking though all the changes I think I agree that this is ok. Fine to merge by me. |
I agree. Note in this case though that this is an "in-house" linter i.e. someone specifically implemented this rule for SymPy (without checking the history my guess would be Aaron). One downside of using p = Pow(x, 2)
assert isinstance(p, Pow) and p.exp == 2
Agreed. There should be no release note here so it should have NO ENTRY instead. |
Fixes #24922
Brief description of what is fixed or changed
This PR resolves partial issue #24922 by improving the code quality from using ".func is" to "isinstance()" in tests.
Other comments
Changes Made:
.func is
withisinstance()
in relevant places in the codebase.Release Notes
.func is
withisinstance()
in relevant places in the codebase.