-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
interpret numbers without decimal as integers
- Loading branch information
Showing
7 changed files
with
141 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
#!/usr/bin/env bash | ||
|
||
echo 'Core tests:' | ||
pytest --ignore='Developer Testing' --ignore-glob='*test_preparser.py' | ||
pytest --ignore='Developer Testing' --ignore-glob='*test_preparser.py' --ignore-glob='*test_numerics.py' | ||
echo 'Doc tests:' | ||
pytest --ignore='tests' --ignore='Developer Testing' --ignore-glob='*old*' --doctest-modules | ||
echo 'Preparser tests:' | ||
ipython -m pytest tests/test_preparser.py | ||
echo 'Preparser and numerics tests (require ipython environment):' | ||
ipython -m pytest tests/test_preparser.py tests/test_numerics.py |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!ipython | ||
|
||
from algebra_with_sympy.preparser import integers_as_exact | ||
from algebra_with_sympy.algebraic_equation import set_integers_as_exact, \ | ||
unset_integers_as_exact, algwsym_config | ||
from IPython import get_ipython | ||
from pytest import raises | ||
|
||
if not(get_ipython()): | ||
raise EnvironmentError('This test module file must be run in an ipython ' | ||
'environment. Use `ipython -m pytest path-to-file`.' | ||
' To avoid running this file in a general test ' | ||
'use `pytest --ignore-glob="*test_numerics.py"`') | ||
|
||
def test_set_integers_as_exact(): | ||
set_integers_as_exact() | ||
assert integers_as_exact in get_ipython().input_transformers_post | ||
assert algwsym_config.numerics.integers_as_exact == True | ||
|
||
def test_integers_as_exact(): | ||
lines = [] | ||
lines.append('1/2*x + 0.333*x') | ||
lines.append('2/3*z + 2.0*y + ln(3*x)') | ||
result = integers_as_exact(lines) | ||
splitlines = result.split('\n') | ||
expectedlines = ['Integer (1 )/Integer (2 )*x +0.333 *x ', | ||
'Integer (2 )/Integer (3 )*z +2.0 *y +ln (Integer (3 )*x )'] | ||
for k in range(len(splitlines)): | ||
assert splitlines[k] == expectedlines[k] | ||
|
||
def test_unset_integers_as_exact(): | ||
unset_integers_as_exact() | ||
assert algwsym_config.numerics.integers_as_exact == False | ||
assert integers_as_exact not in get_ipython().input_transformers_post |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = '0.11.0' | ||
__version__ = '0.12.0.dev0' |