-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Add tokenizer tests for Not operator (!). #28497
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
Conversation
Based on feedback, test cases are added in the mentioned block testing that S-expression equivalent is correctly parsed before converting to a SymPy expression.
|
✅ 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.
Click here to see the pull request description that was parsed. |
|
@Upabjojr I have added the test cases based on feedback, do let me know if any further improvements are needed. |
| # Combination of Not with And/Or | ||
| assert chain("!x && y") == ["And", ["Not", "x"], "y"] | ||
| assert chain("x || !y") == ["Or", "x", ["Not", "y"]] | ||
| assert chain("!x || !y") == ["Or", ["Not", "x"], ["Not", "y"]] |
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.
What happens with "x!y" ?
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.
I tested this and parse_mathematica returns y*factorial(x). I believe that this should be the expected behavior when such expressions are encountered. I have also added further test cases to document this behavior.
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.
Does Wolfram Mathematica return the same? Was just wondering whether prefix or postfix has a higher precedence with ! in Mathematica.
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.
I tested x!y in https://www.wolframalpha.com/ and it is returning yΓx+1. It does return the same I believe (with Γx+1 = x!).
|
Thank you for your contribution! |
Based on feedback, test cases are added in
test_parser_mathematica_tokenizer, testing that S-expression equivalent is correctly parsed before converting to a SymPy expression.References to other Issues or PRs
Follow-up to #28492
Brief description of what is fixed or changed
Added tests for Not operator(!) inside the aforementioned test block.
Other comments
Release Notes
NO ENTRY