def test_adding_different_units(self, firstValue, secondValue, firstUnit, secondUnit): value_a = TypedValue(firstValue, firstUnit) value_b = TypedValue(secondValue, secondUnit) try: value_a.add(value_b) except ValueError: pass else: self.fail("expected a ValueError")
def test_adding_same_unit(self, firstValue, secondValue, unit): value_a = TypedValue(firstValue, unit) value_b = TypedValue(secondValue, unit) result = value_a.add(value_b) assert_that(result.unit, equal_to(unit)) assert_that(result.value, equal_to(firstValue+secondValue))