Skip to content
This repository has been archived by the owner on Mar 29, 2023. It is now read-only.

Commit

Permalink
Fixed IndexError on Empty Call, returns None, same a empty function
Browse files Browse the repository at this point in the history
  • Loading branch information
glenfletcher committed Jul 7, 2014
1 parent 8a67865 commit dde51ed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Equation/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,8 @@ def __call__(self,*args,**kwargs):
varies
Result of evaluating the Expression, type will depende appon the expression and the variables used to evaluate the expression.
"""
if len(self.__expr) == 0:
return None
self.variables = {}
self.variables.update(constants) # i.e. pi, e, i, etc.
self.variables.update(self.__vars)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_Equation.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ def testRepr(self):

def testStr(self):
self.assertEqual(str(self.fn),"")

def testCall(self):
self.assertEqual(self.fn(), 0)
self.assertEqual(self.fn(), None)

def tearDown(self):
pass
Expand Down

0 comments on commit dde51ed

Please sign in to comment.