def test_subtract_different_unit(self): a = meters(1) b = kilometers(1) with self.assertRaises(OperationError): print(a - b)
def test_add_same_unit(self): a = meters(1) b = meters(2) expected = meters(3) self.assertEqual(expected, a + b)
def test_subtract_same_unit(self): a = meters(5) b = meters(2) expected = meters(3) self.assertEqual(expected, a - b)
def test_equal(self): km_in_m = meters(1000) km = kilometers(1) self.assertEqual(km, km_in_m)