Skip to content

Instantly share code, notes, and snippets.

@nagavenkateshgowru
Last active February 14, 2020 10:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nagavenkateshgowru/072df282ba0a7816595659d9c995609d to your computer and use it in GitHub Desktop.
Save nagavenkateshgowru/072df282ba0a7816595659d9c995609d to your computer and use it in GitHub Desktop.
Added test cases for evaluation sub, div, mult expressions
from calculator import calc, get_values_from_expr
def test_calc_add():
result = calc("3 + 2")
assert result == 5
def test_calc_add2():
result = calc("300 + 20")
assert result == 320
def test_calc_sub1():
result = calc("5 - 3")
assert result == 2
def test_get_values_from_expr_add():
result = get_values_from_expr("120 + 20")
assert result == ['120', '20']
def test_get_values_from_expr_sub():
result = get_values_from_expr("120 - 20")
assert result == ['120', '20']
def test_get_values_from_expr_div():
result = get_values_from_expr("120 / 20")
assert result == ['120', '20']
def test_get_values_from_expr_mul():
result = get_values_from_expr("120 * 20")
assert result == ['120', '20']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment