def strike(ctx, grain, vol, temp): """ Calculate the required strike water temperature given the mass of grains, volume of water, and desired final mash temperature """ if not grain: grain = inputs.get_unit_input(ctx.obj["units"]["lrg_weight"], "Weight of grains: ") if not vol: vol = inputs.get_unit_input(ctx.obj["units"]["vol"], "Volume of water: ") if not temp: temp = inputs.get_unit_input(ctx.obj["units"]["temp"], "Desired mash temp: ") if is_metric(ctx): grain = bm.kg_to_lbs(grain) vol = bm.l_to_g(vol) temp = bm.c_to_f(temp) strike_temp = bm.strike_temp(grain, vol, temp) if is_metric(ctx): strike_temp = bm.f_to_c(strike_temp) print("Strike water temp should be {0:.3f}{1}".format( strike_temp, ctx.obj["units"]["temp"]))
def test_c_to_f_to_c(): f = bm.c_to_f(115) c = bm.f_to_c(f) assert c == 115
def test_f_to_c_to_f(): c = bm.f_to_c(244.4) f = bm.c_to_f(c) assert f == 244.4
def test_f_to_c(): c = bm.f_to_c(82.4) assert c == pytest.approx(28, 0.1)