Minor improvements to unit test cases and updated pybison.

parent 474ea0ed
pybison @ 858c8461
Subproject commit f1e152a6c890c168ab2c1a4cafaf82b3d3a672fc
Subproject commit 858c8461cb56a983ca63ad7420919673f2d91014
......@@ -3,6 +3,7 @@
A simple pybison parser program implementing a calculator
"""
from __future__ import division
from sympy import Symbol
from logger import filter_non_ascii
......@@ -48,6 +49,7 @@ class Parser(BisonParser):
def __init__(self, **kwargs):
BisonParser.__init__(self, **kwargs)
self.interactive = kwargs.get('interactive', 0)
self.timeout = kwargs.get('timeout', 0)
# ------------------------------------------------------------------
# override default read method with a version that prompts for input
......@@ -117,8 +119,9 @@ class Parser(BisonParser):
# rule: NUMBER
if option == 0:
# TODO: A bit hacky, this achieves long integers and floats.
# return float(values[0]) if '.' in values[0] else long(values[0])
return float(values[0])
#return float(values[0]) if '.' in values[0] else long(values[0])
#return float(values[0])
return float(values[0]) if '.' in values[0] else int(values[0])
# rule: IDENTIFIER
if option == 1:
......
......@@ -26,8 +26,8 @@ class TestCalc(unittest.TestCase):
run_expressions(expressions)
def test_infinity(self):
expressions = [('2^9999', None),
('2^-9999', 0.0),
expressions = [('2^3000', 2**3000),
('2^-3000', 0.0),
('2^99999999999', None),
('2^-99999999999', 0.0)]
......
......@@ -19,7 +19,7 @@ class TestVariables(unittest.TestCase):
def test_addition_of_two_terms(self):
a, b = symbols('a,b')
expressions = [('4*a + 5*b', 4.0*a + 5.0*b)]
expressions = [('4*a + 5*b', 4*a + 5*b)]
run_expressions(expressions)
#def test_short_addition_of_two_terms(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment