예제 #1
0
def test_gu():

    fermentable = Fermentable()
    fermentable._yield = 1
    fermentable.amount = 1  #kg

    assert (fermentable.gu() == 3.8567413912148134)
예제 #2
0
def test_ppg():

    fermentable = Fermentable()
    # pylint: disable=protected-access
    fermentable._yield = 1

    assert fermentable.ppg == 0.46214
예제 #3
0
def test_gu():

    fermentable = Fermentable()
    fermentable._yield = 1
    fermentable.amount = 1 #kg

    assert(fermentable.gu() == 3.8567413912148134)
예제 #4
0
def test_gu():

    fermentable = Fermentable()
    # pylint: disable=protected-access
    fermentable._yield = 1
    fermentable.amount = 1  # kg

    assert fermentable.gu() == 3.8567413912148134
예제 #5
0
def test_addition():

    fermentable = Fermentable()

    fermentable.name = "Munich Malt"
    assert (fermentable.addition == "steep")

    fermentable.name = "Honey"
    assert (fermentable.addition == "boil")

    fermentable.name = None
    assert (fermentable.addition == "mash")
예제 #6
0
def test_addition():

    fermentable = Fermentable()

    fermentable.name = "Munich Malt"
    assert(fermentable.addition == "steep")

    fermentable.name = "Honey"
    assert(fermentable.addition == "boil")

    fermentable.name = None
    assert(fermentable.addition == "mash")
예제 #7
0
def test_add_after_boil():

    fermentable = Fermentable()
    fermentable.add_after_boil = True

    assert (fermentable.add_after_boil == True)
예제 #8
0
def test_ppg():

    fermentable = Fermentable()
    fermentable._yield = 1

    assert (fermentable.ppg == 0.46214)
예제 #9
0
    def parse_recipe(self, recipe_node: Element) -> Recipe:

        recipe = Recipe()

        for recipe_property in list(recipe_node):
            tag_name = to_lower(recipe_property.tag)

            if tag_name == "fermentables":
                for fermentable_node in list(recipe_property):
                    fermentable = Fermentable()
                    self.nodes_to_object(fermentable_node, fermentable)
                    recipe.fermentables.append(fermentable)

            elif tag_name == "yeasts":
                for yeast_node in list(recipe_property):
                    yeast = Yeast()
                    self.nodes_to_object(yeast_node, yeast)
                    recipe.yeasts.append(yeast)

            elif tag_name == "hops":
                for hop_node in list(recipe_property):
                    hop = Hop()
                    self.nodes_to_object(hop_node, hop)
                    recipe.hops.append(hop)

            elif tag_name == "miscs":
                for misc_node in list(recipe_property):
                    misc = Misc()
                    self.nodes_to_object(misc_node, misc)
                    recipe.miscs.append(misc)

            elif tag_name == "style":
                style = Style()
                recipe.style = style
                self.nodes_to_object(recipe_property, style)

            elif tag_name == "waters":
                for water_node in list(recipe_property):
                    water = Water()
                    self.nodes_to_object(water_node, water)
                    recipe.waters.append(water)

            elif tag_name == "equipment":
                equipment = Equipment()
                recipe.equipment = equipment
                self.nodes_to_object(recipe_property, equipment)

            elif tag_name == "mash":
                mash = Mash()
                recipe.mash = mash

                for mash_node in list(recipe_property):
                    if to_lower(mash_node.tag) == "mash_steps":
                        for mash_step_node in list(mash_node):
                            mash_step = MashStep()
                            self.nodes_to_object(mash_step_node, mash_step)
                            mash.steps.append(mash_step)
                    else:
                        self.node_to_object(mash_node, mash)

            else:
                self.node_to_object(recipe_property, recipe)

        return recipe
예제 #10
0
def test_add_after_boil():

    fermentable = Fermentable()
    fermentable.add_after_boil = True

    assert(fermentable.add_after_boil == True)
예제 #11
0
def test_ppg():

    fermentable = Fermentable()
    fermentable._yield = 1

    assert(fermentable.ppg == 0.46214)