def test_conversion_type_error(source, target): with pytest.raises(TypeError): conversion_factor(source, target)
def test_conversion_invalid_units(): with pytest.raises(ValueError): conversion_factor(25, 6)
def test_conversion_factor(source, target, factor): assert conversion_factor(source, target) == pytest.approx(factor)