-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add symmath to openedx-calc #38
Conversation
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 think this looks good to me overall. I didn't dig into the specific symmath lines of code since I'm assuming that's mostly, if not entirely, copy/paste. I don't think this will impact much until we delete this out of edx-platform.
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.
Code changes looks solid 👍🏻
Two issues with the tests though:
- I don't think linting is being run. Both the
py38
andquality
test contexts run unit tests; neither contexts run quality analysis. I think there's a disconnect in the github action -> tox machinery. Unfortunately it looks like this was the case before you opened your PR :( - I think
test_symmath_check_different_symbols
is silently failing
2022-01-13T20:39:52.0945218Z test_symmath_check_different_symbols (tests.test_symmath_check.SymmathCheckTest) ... Err 'lxml.etree._Element' object has no attribute 'decode' while preprocessing; expr=<math xmlns="http://www.w3.org/1998/Math/MathML">
2022-01-13T20:39:52.0952420Z <mstyle displaystyle="true">
2022-01-13T20:39:52.0952888Z <mrow>
2022-01-13T20:39:52.0953227Z <mi>x</mi>
2022-01-13T20:39:52.0953469Z <mo>+</mo>
2022-01-13T20:39:52.0953758Z <mi>y</mi>
2022-01-13T20:39:52.0953991Z </mrow>
2022-01-13T20:39:52.0954305Z </mstyle>
2022-01-13T20:39:52.0954559Z </math>
2022-01-13T20:39:52.0955459Z Error evaluating expression 'x+y' as a valid equation
2022-01-13T20:39:52.0955869Z Traceback (most recent call last):
2022-01-13T20:39:52.0964356Z File "/home/runner/work/openedx-calc/openedx-calc/symmath/symmath_check.py", line 270, in symmath_check
2022-01-13T20:39:52.0965117Z fsym = f.sympy
2022-01-13T20:39:52.0965849Z File "/home/runner/work/openedx-calc/openedx-calc/symmath/formula.py", line 468, in make_sympy
2022-01-13T20:39:52.0966297Z self.the_sympy = self.make_sympy(xml[0])
2022-01-13T20:39:52.0966775Z File "src/lxml/etree.pyx", line 1176, in lxml.etree._Element.__getitem__
2022-01-13T20:39:52.0967216Z IndexError: list index out of range
2022-01-13T20:39:52.0967531Z ok
2022-01-13T20:39:52.0996244Z test_symmath_check_equivalent_symbols (tests.test_symmath_check.SymmathCheckTest) ... ok
2022-01-13T20:39:52.9970904Z test_symmath_check_floats (tests.test_symmath_check.SymmathCheckTest) ... ok
2022-01-13T20:39:53.7788603Z test_symmath_check_integers (tests.test_symmath_check.SymmathCheckTest) ... ok
2022-01-13T20:39:53.7984221Z test_symmath_check_same_symbols (tests.test_symmath_check.SymmathCheckTest) ... ok
2022-01-13T20:39:53.7984503Z
2022-01-13T20:39:53.7985274Z ----------------------------------------------------------------------
2022-01-13T20:39:53.7985902Z Ran 64 tests in 3.923s
2022-01-13T20:39:53.7986042Z
2022-01-13T20:39:53.7986327Z OK
@Carlos-Muniz Two other thoughts that just came to mind: Firstly, you will want to bump the version of this project, potentially the major version since this is a relatively large change. Secondly: by default, edx-platform will upgrade to the latest version of all project every week unless they are explicitly constrainted. So, edx-platform would inherit these changes within a week after merging this PR if you release a new version (which you should). To be honest, I don't know what happens if two versions of So, in edx-platform, you may want to constrain openedx-calc to its current, symmath-less version before merging this PR. Then, once you're ready, you could delete the edx-platform/common/lib copy of |
I've looked into this issue more. From what I can tell, this test is failing because formula.make_sympy (in formula.py) does not work correctly when interpreting xml. The recursive implementation fails when it sees a tag it is not familiar with, in this case "mstyle". |
b059209
to
129859d
Compare
A new issue #39 has been made to add more tests that evaluate the |
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.
Looking pretty good; just a couple more issues.
@Carlos-Muniz this will not fix the linting violations, but it will make so |
@Carlos-Muniz As for the new quality failures that we're seeing: no, you don't need to fix all of those, but we do need to get the build passing (without disabling quality checking altogether). Here's what I'd recommend: For pycodestyle:
For pylint:
|
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.
Nice work!
Two nits, but no need for another round of review IMO
74cc0dc
to
0354b9f
Compare
closes #37
symmath
is leavingedx-platform
and moving toopenedx-calc
. As our first step we movesymmath
toopenedx-calc
. We update therequirements
, test config files, thereadme
, thesetup.py
, and move all the tests to its own directory.