def div_zero(self): calculator = Calculator() result = calculator.divide(1, 0) expected_result = None assert result == expected_result
def test_divide(self, a, b, expected_result): calculator = Calculator() result = calculator.divide(a, b) assert_almost_equal(result, expected_result, 6)
def test_capsys(self, capsys): calculator = Calculator() calculator.divide(2, 0) div_zero_message = "div_by_0\n" out, err = capsys.readouterr() assert div_zero_message == out