def test_dividing_by_zero(self, firstValue, secondValue, firstUnit, secondUnit): value_a = TypedValue(firstValue, firstUnit) value_b = TypedValue(secondValue, secondUnit) try: value_a.divide(value_b) except ZeroDivisionError: pass else: self.fail("expected a ZeroDivisionError")
def test_dividing_different_units(self, firstValue, secondValue, firstUnit, secondUnit): value_a = TypedValue(firstValue, firstUnit) value_b = TypedValue(secondValue, secondUnit) result = value_a.divide(value_b) assert_that(result.unit, equal_to(firstUnit + "/" + secondUnit)) assert_that(result.value, equal_to(firstValue / secondValue))