def test_bad_inputs(arg): with pytest.raises(ValueError): simple_calculator(arg)
def test_true_division(arg, expected): assert round(simple_calculator(arg), 2) == expected
def test_multiply(arg, expected): assert simple_calculator(arg) == expected
def test_subtract(arg, expected): assert simple_calculator(arg) == expected
import calculator import file #Comment try: answer = 1 while answer < 3 and answer > 0: answer = int(input("What would you like to do? \n(1) Simple Calculator \n(2) Create / Edit / Read a File \n(3) Nothing \nAnswer: ")) if answer == 1: print("\nYou chose '1'.") num1 = float(input("First number: ")) num2 = float(input("Second number: ")) operator = input ("What to do with it: ") calculator.simple_calculator(num1,num2,operator) elif answer == 2: print("\nYou chose '2'.") option = input("Create, Edit, or Read a file: ") if option.lower() == "create": file.create_file() elif option.lower() == "edit": file.edit_file() elif option.lower() == "read": file.read_file() else: print("That is not an option.\n") else: print("\nYou chose '3' or a number that is out of range. Bye.")
def test_sum_floats(arg, expected): assert simple_calculator(arg) == expected