Last active
February 14, 2020 10:53
-
-
Save nagavenkateshgowru/072df282ba0a7816595659d9c995609d to your computer and use it in GitHub Desktop.
Added test cases for evaluation sub, div, mult expressions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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