# Copyright 2019 Mike Shoup # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from humulus.filters import * def test_recipe_og(sample_recipes): assert recipe_og(sample_recipes['lager']) == '1.054' assert recipe_og(sample_recipes['sweetstout']) == '1.038' # Remove fermentables, verify 0 is returned sample_recipes['lager'].pop('fermentables') assert recipe_og(sample_recipes['lager']) == '0.000' def test_recipe_fg(sample_recipes): assert recipe_fg(sample_recipes['lager']) == '1.014' assert recipe_fg(sample_recipes['sweetstout']) == '1.015' # Remove fermentables, verify 0 is returned sample_recipes['lager'].pop('fermentables') assert recipe_fg(sample_recipes['lager']) == '0.000' # Remove yeast, verify 0 is returned sample_recipes['sweetstout'].pop('yeast') assert recipe_fg(sample_recipes['sweetstout']) == '0.000' def test_recipe_ibu(sample_recipes): assert recipe_ibu(sample_recipes['lager']) == '26' assert recipe_ibu(sample_recipes['sweetstout']) == '34' # Remove hops, verify 0 is returned sample_recipes['lager'].pop('hops') assert recipe_ibu(sample_recipes['lager']) == '0'