Example #1
0
def test_str():
    calculator = BasicCalc()
    with pytest.raises(TypeError):
        calculator.divide("four", 2)




# thank god for stackoverlow
# Pating "pytest --show-capture" in terminal allowed me to see which tests would fail
Example #2
0
def test_man_fail():
    calculator = BasicCalc()
    with pytest.fail("I made this one fail."):
        calculator.add(2, 2)
Example #3
0
def test_zero_div():
    calculator = BasicCalc()
    result = calculator.divide(5, 0)
    assert result == "ZeroDivisionError"
Example #4
0
def test_will_fail():
    calculator = BasicCalc()
    result = calculator.add(2, 2)
    assert result == 5
Example #5
0
def test_divide():
    calculator = BasicCalc()
    result = calculator.divide(2, 2)
    assert result == 1
Example #6
0
def test_multiply():
    calculator = BasicCalc()
    result = calculator.multiply(2, 2)
    assert result == 4
Example #7
0
def test_subtract():
    calculator = BasicCalc()
    result = calculator.subtract(2, 2)
    assert result == 0
Example #8
0
def test_add():
    calculator = BasicCalc()
    result = calculator.add(2, 2)
    assert result == 4
Example #9
0
def test_str():
    calculator = BasicCalc()
    with pytest.raises(TypeError):
        calculator.divide("four", 2)