Created
February 14, 2020 11:18
-
-
Save nagavenkateshgowru/56adabcd443d42d902db27c82e180b7e to your computer and use it in GitHub Desktop.
Added all add, sub, mul, div test cases
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'] | |
def test_calc_sub2(): | |
result = calc("540 - 30") | |
assert result == 510 | |
def test_calc_mul(): | |
result = calc("5 * 4") | |
assert result == 20 | |
def test_calc_div(): | |
result = calc("8 / 4") | |
assert result == 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment