Skip to content
Snippets Groups Projects
Commit 09104d70 authored by ehcole's avatar ehcole
Browse files

added too many args test

parent d34d6b0d
Branches main
No related tags found
No related merge requests found
No preview for this file type
No preview for this file type
...@@ -14,6 +14,7 @@ def calculate(arg): ...@@ -14,6 +14,7 @@ def calculate(arg):
elif token == '-': elif token == '-':
result = val1 - val2 result = val1 - val2
stack.append(result) stack.append(result)
return stack[0] return stack[0]
......
...@@ -8,3 +8,6 @@ class TestBasics(unittest.TestCase): ...@@ -8,3 +8,6 @@ class TestBasics(unittest.TestCase):
def test_subtract(self): def test_subtract(self):
result = rpn.calculate('4 3 -') result = rpn.calculate('4 3 -')
self.assertEqual(1, result) self.assertEqual(1, result)
def test_toomany(self):
with self.assertRaises(ValueError):
result = rpn.calculate('1 2 3 +')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment