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

Commit

Permalink
Correctly add agruments to positional list, added test case
Browse files Browse the repository at this point in the history
  • Loading branch information
glenfletcher committed Jul 7, 2014
1 parent 37aab1e commit b9bca27
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Equation/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ def __compile(self):
__expect_op = False
elif not __expect_op and v[1] == 'NAME':
self.__argsused.add(v[0])
if v not in self.__args:
if v[0] not in self.__args:
self.__args.append(v[0])
self.__expr.append(ExpressionVariable(v[0]))
__expect_op = True
Expand Down
13 changes: 13 additions & 0 deletions tests/test_Equation.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,19 @@ def testStr(self):
def tearDown(self):
pass

class TestPostionalArgs(unittest.TestCase):
def setUp(self):
self.fn = Expression("x+x-y")

def testCall(self):
try:
self.fn(1,2)
except TypeError:
self.fail("Postional Args Rises a TypeError Exception.")

def tearDown(self):
pass

class TestComplexEquation(unittest.TestCase):
def setUp(self):
pass
Expand Down

0 comments on commit b9bca27

Please sign in to comment.