def test__calc_grain_bill__calculates():

    grain_recipe = (
        ('American Wheat', .67, .68),
        ('American Pale (2-Row)', .33, .68)
    )
    grain_bill = calculator.calc_grain_bill(1.052, 5.5, grain_recipe)

    wheat_weight = calculator.convert_lbs_to_lbs_ounces(calculator.to_decimal(52 * 5.5 * .67 / (38 * .68), 3))
    pale_weight = calculator.convert_lbs_to_lbs_ounces(calculator.to_decimal(52 * 5.5 * .33 / (37 * .68), 3))
    assert grain_bill == (('American Wheat', wheat_weight), ('American Pale (2-Row)', pale_weight))
Example #2
0
def test__calc_grain_bill__calculates():

    grain_recipe = (('American Wheat', .67, .68), ('American Pale (2-Row)',
                                                   .33, .68))
    grain_bill = calculator.calc_grain_bill(1.052, 5.5, grain_recipe)

    wheat_weight = calculator.convert_lbs_to_lbs_ounces(
        calculator.to_decimal(52 * 5.5 * .67 / (38 * .68), 3))
    pale_weight = calculator.convert_lbs_to_lbs_ounces(
        calculator.to_decimal(52 * 5.5 * .33 / (37 * .68), 3))
    assert grain_bill == (('American Wheat', wheat_weight),
                          ('American Pale (2-Row)', pale_weight))
def test__to_decimal__converts():
    # test with default arg value
    assert calculator.to_decimal(0.9876) == Decimal('0.988')
    assert calculator.to_decimal(1.001) == Decimal('1.001')
    assert calculator.to_decimal(99.12345) == Decimal('99.123')
    assert calculator.to_decimal(999.6789) == Decimal('999.679')

    # test with all arg values
    assert calculator.to_decimal(0.9876, 0) == Decimal('1')
    assert calculator.to_decimal(1.001, 2) == Decimal('1.00')
    assert calculator.to_decimal(99.12345, 4) == Decimal('99.1235')
    assert calculator.to_decimal(999.6789, 5) == Decimal('999.67890')
Example #4
0
def test__to_decimal__converts():
    # test with default arg value
    assert calculator.to_decimal(0.9876) == Decimal('0.988')
    assert calculator.to_decimal(1.001) == Decimal('1.001')
    assert calculator.to_decimal(99.12345) == Decimal('99.123')
    assert calculator.to_decimal(999.6789) == Decimal('999.679')

    # test with all arg values
    assert calculator.to_decimal(0.9876, 0) == Decimal('1')
    assert calculator.to_decimal(1.001, 2) == Decimal('1.00')
    assert calculator.to_decimal(99.12345, 4) == Decimal('99.1235')
    assert calculator.to_decimal(999.6789, 5) == Decimal('999.67890')