import unittest
import calc 

class TestCalc(unittest.TestCase):
  def test_add(self):
    self.assertEqual( calc.add(10,5), 15)
    self.assertEqual( calc.add(-1,1), 0)
    self.assertEqual( calc.add(-1,-1), -2)

  def test_subtract(self):
    self.assertEqual( calc.subtract(10,5), 5)
    self.assertEqual( calc.subtract(-1,1), -2)
    self.assertEqual( calc.subtract(-1,-1), 0)

  def test_multiply(self):
    self.assertEqual( calc.multiply(10,5), 50)
    self.assertEqual( calc.multiply(-1,1), -1)
    self.assertEqual( calc.multiply(-1,-1), 1)

  def test_divide(self):
    self.assertEqual( calc.divide(10,5), 2)
    self.assertEqual( calc.divide(-1,1), -1)
    self.assertEqual( calc.divide(-1,-1), 1)

    #test if function raises the correct error
    self.assertRaises(ValueError, calc.divide, 10, 0)

    #use context manager so you can call function normally
    with self.assertRaises(ValueError):
      calc.divide(10,0)

#basically saying if we run this module directly, the run the code in the conditional
if __name__ == '__main__':
  unittest.main()