def test2():
    calc = Calc()
    calc.start(5)
    calc.add(3)
    output = calc.add(4)
    assert_equals(output, 12, "Wrong Calculation.")
    calc.reset()
def test3():
    calc = Calc()
    calc.start(5)
    calc.sub(3)
    output = calc.sub(1)
    assert_equals(output, 1, "Wrong Calculation.")
    calc.reset()
def test1():
    calc = Calc()
    calc.start(5)
    output = calc.add(4)
    if output != 9:
        raise AssertionError("Wrong calculation. Expected: {}. Got {}".format(
            9, output))
    calc.reset()
def test3():
    calc = Calc()
    calc.start(5)
    calc.sub(3)
    output = calc.sub(1)
    if output != 1:
        raise AssertionError("Wrong calculation. Expected: {}. Got {}".format(
            1, output))
    calc.reset()
def test4():
    calc = Calc()
    calc.start(5)
    output = calc.add(4)
    try:
        calc.complain()
    except Exception:
        pass
    else:
        raise Exception("Expected exception not raised.")
    calc.reset()
class CalcTest(unittest.TestCase):
    @classmethod
    def setUp(self):
        self.calc = Calc()

    @classmethod
    def tearDown(self):
        self.calc.reset()

    def test1(self):
        self.calc.start(5)
        output = self.calc.add(4)
        self.assertEqual(output, 9, "Wrong Calculation.")

    def test2(self):
        self.calc.start(5)
        self.calc.add(3)
        output = self.calc.add(4)
        self.assertEqual(output, 12, "Wrong Calculation.")

    def test3(self):
        self.calc.start(5)
        self.calc.sub(3)
        output = self.calc.sub(1)
        self.assertEqual(output, 1, "Wrong Calculation.")

    def test4(self):
        self.calc.start(5)
        output = self.calc.add(4)
        with self.assertRaises(Exception) as cm:
            self.calc.complain()
        self.assertIn("Expected", str(cm.exception))

    def test5(self):
        self.calc.start(5)
        output = self.calc.add(4)
        self.calc.why_complain()
def test5():
    calc = Calc()
    calc.start(5)
    output = calc.add(4)
    calc.why_complain()  # Code exit
    calc.reset()
def test4():
    calc = Calc()
    calc.start(5)
    output = calc.add(4)
    assert_exc(calc.complain, "Expected", "Calc did not complain properly.")
    calc.reset()
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from faulty_calc import Calc

# Just interacting
# You know the OUT does not complain. But how do you know it does what you want it to do?

# Test 1
calc = Calc()
calc.start(5)
output = calc.add(4)
calc.reset()

# Test 2
calc = Calc()
calc.start(5)
calc.add(3)
output = calc.add(4)
calc.reset()

# Test 3
calc = Calc()
calc.start(5)
calc.sub(3)
output = calc.sub(1)
calc.reset()