Conversation
…suring coverage for various edge cases and workflows
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem:
Students using international keyboards may produce Unicode dash characters — such as the en dash (–), em dash (—), or Unicode minus sign (−) — instead of the ASCII hyphen-minus (-) when entering a minus sign. These characters
are visually identical to - but are not recognised by the SymPy parser, causing valid expressions to fail silently.
Fix:
Added convert_unicode_dashes(expr) to expression_utilities.py. The function follows the same substitution-pair pattern as the existing transform_unicode_greek_symbols: it inspects the expression string for any of the eight.
Unicode dash variants and returns (unicode_char, "-") pairs to be applied during preprocessing, before the expression reaches the parser.
All other changes are tests. A new file app/tests/expression_utilities_test.py adds direct unit tests for every public function in expression_utilities, including the new function (13 cases covering each dash variant,
multi-dash expressions, and the no-dash case).