-
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding pytests for from_sympy / to_sympy. (#828)
This PR adds some basic tests to check the consistency in the behavior of `from_sympy`. When I was writing the tests, I found some issues in the behavior of these functions, and also some failures in the modularity. So, this PR * moves `mathics_to_sympy` and `sympy_to_mathics` dicts from `mathics.builtin` to `mathics.core.convert.sympy`. This allows for avoiding some local imports. * `to_numeric_sympy_args` was moved from `mathics.core.convert.expression` to `mathics.core.convert.sympy`, which again helps to reduce local imports. * moves the implementation of `Expression.to_sympy` and `Symbol.to_sympy` to `mathics.core.convert.sympy`. * Constant expressions like `MATHICS_*INFINITY` and numbers `MATHICS_COMPLEX_I` were included in `mathics.core.expression` to avoid local duplication. * Improves the implementation of `Symbol.to_sympy` by using a dictionary to translate some predefined symbols in SymPy, like `pi`, `E`, `GoldenRatio` or `I`. * adds pytests for `from_sympy` and `to_sympy`. In the code, it is also a proposal for a rewriting of `from_sympy` using dictionaries, which could help to get a clearer code.
- Loading branch information
Showing
13 changed files
with
370 additions
and
103 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.