def test_multiplying_same_unit(self, firstValue, secondValue, unit): value_a = TypedValue(firstValue, unit) value_b = TypedValue(secondValue, unit) result = value_a.multiply(value_b) assert_that(result.unit, equal_to(unit + "^2")) assert_that(result.value, equal_to(firstValue * secondValue))
def test_multiplying_same_unit_different_powers_totalling_1(self, firstValue, secondValue, unit, firstPower, secondPower): value_a = TypedValue(firstValue, "%s^%s" % (unit, firstPower)) value_b = TypedValue(secondValue, "%s^%s" % (unit, secondPower)) result = value_a.multiply(value_b) assert_that(result.unit, equal_to(unit)) assert_that(result.value, equal_to(firstValue * secondValue))
def test_multiplying_different_units(self, firstValue, secondValue, firstUnit, secondUnit): value_a = TypedValue(firstValue, firstUnit) value_b = TypedValue(secondValue, secondUnit) result = value_a.multiply(value_b) assert_that(result.unit, equal_to(firstUnit + secondUnit)) assert_that(result.value, equal_to(firstValue*secondValue))