mirror of
https://github.com/shouptech/synthale.git
synced 2026-02-03 15:39:45 +00:00
Add zero length mash & misc ingredients.
This commit is contained in:
parent
39318f8ed1
commit
e72eeb100c
3 changed files with 42 additions and 25 deletions
|
|
@ -63,7 +63,7 @@ class MarkdownRecipe:
|
|||
@property
|
||||
def markdown(self):
|
||||
"""Return generated markdown for the recipe."""
|
||||
return '\n'.join((
|
||||
md = '\n'.join((
|
||||
self.name,
|
||||
'',
|
||||
self.style,
|
||||
|
|
@ -76,12 +76,16 @@ class MarkdownRecipe:
|
|||
'',
|
||||
self.yeast,
|
||||
'',
|
||||
self.miscs,
|
||||
'',
|
||||
self.mash,
|
||||
'',
|
||||
))
|
||||
|
||||
if len(self.miscs) > 0:
|
||||
md += '\n'.join(('', self.miscs, '',))
|
||||
|
||||
if len(self.mash) > 0:
|
||||
md += '\n'.join(('', self.mash, '',))
|
||||
|
||||
return md
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""Return markdown for the recipe's name."""
|
||||
|
|
@ -211,6 +215,9 @@ class MarkdownRecipe:
|
|||
@property
|
||||
def miscs(self):
|
||||
"""Return the markdown to represent the recipe's other ingredients."""
|
||||
if len(self.recipe.miscs) == 0:
|
||||
return ''
|
||||
|
||||
headers = ('Name', 'Use', 'Amount')
|
||||
rows = []
|
||||
for misc in self.recipe.miscs:
|
||||
|
|
@ -235,6 +242,9 @@ class MarkdownRecipe:
|
|||
@property
|
||||
def mash(self):
|
||||
"""Return the markdown to represent the recipe's mash steps."""
|
||||
if self.recipe.mash is None:
|
||||
return ''
|
||||
|
||||
headers = ('Name', 'Type', 'Temperature', 'Time', 'Amount')
|
||||
rows = []
|
||||
for step in self.recipe.mash.steps:
|
||||
|
|
|
|||
|
|
@ -87,21 +87,6 @@
|
|||
</YEAST>
|
||||
</YEASTS>
|
||||
<MISCS/>
|
||||
<MASH>
|
||||
<NAME>Single Step Infusion, 148 F</NAME>
|
||||
<VERSION>1</VERSION>
|
||||
<GRAIN_TEMP>22.0</GRAIN_TEMP>
|
||||
<MASH_STEPS>
|
||||
<MASH_STEP>
|
||||
<NAME>Infusion</NAME>
|
||||
<VERSION>1</VERSION>
|
||||
<TYPE>Infusion</TYPE>
|
||||
<STEP_TEMP>64.4444</STEP_TEMP>
|
||||
<STEP_TIME>60.0</STEP_TIME>
|
||||
<INFUSE_AMOUNT>17.0344</INFUSE_AMOUNT>
|
||||
</MASH_STEP>
|
||||
</MASH_STEPS>
|
||||
</MASH>
|
||||
<TYPE>All Grain</TYPE>
|
||||
<BREWER>Mike Shoup</BREWER>
|
||||
<BATCH_SIZE>20.81976479</BATCH_SIZE>
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ def test_recipe_yeast(md_weizen):
|
|||
)
|
||||
|
||||
|
||||
def test_recipe_miscs(md_coffee_stout):
|
||||
def test_recipe_miscs(md_coffee_stout, md_weizen):
|
||||
"""Test valid miscellaneous ingredient table is generated."""
|
||||
assert md_coffee_stout.miscs == (
|
||||
'Other Ingredients\n'
|
||||
|
|
@ -168,17 +168,39 @@ def test_recipe_miscs(md_coffee_stout):
|
|||
'| Coffee (Brewed) | Keg | 0.71 kg |'
|
||||
)
|
||||
|
||||
assert md_weizen.miscs == ''
|
||||
|
||||
def test_recipe_mash(md_coffee_stout):
|
||||
|
||||
def test_recipe_mash(md_coffee_stout, md_weizen):
|
||||
"""Test valid recipe mash table."""
|
||||
assert md_coffee_stout.mash == (
|
||||
'Mash\n'
|
||||
'----\n'
|
||||
'| Name | Type | Temperature | Time | Amount |\n'
|
||||
'| -------- | -------- | ----------- | ------ | -------- |\n'
|
||||
'| Infusion | Infusion | 152.0 °F | 60 min | 37.55 lb |'
|
||||
'| Name | Type | Temperature | Time | Amount |\n'
|
||||
'| -------- | -------- | ----------- | ------ | ------- |\n'
|
||||
'| Infusion | Infusion | 152.0 °F | 60 min | 4.5 gal |'
|
||||
)
|
||||
|
||||
md_coffee_stout.temp_unit = 'celsius'
|
||||
assert md_coffee_stout.mash == (
|
||||
'Mash\n'
|
||||
'----\n'
|
||||
'| Name | Type | Temperature | Time | Amount |\n'
|
||||
'| -------- | -------- | ----------- | ------ | ------- |\n'
|
||||
'| Infusion | Infusion | 66.7 °C | 60 min | 4.5 gal |'
|
||||
)
|
||||
|
||||
md_coffee_stout.vol_unit = 'liters'
|
||||
assert md_coffee_stout.mash == (
|
||||
'Mash\n'
|
||||
'----\n'
|
||||
'| Name | Type | Temperature | Time | Amount |\n'
|
||||
'| -------- | -------- | ----------- | ------ | ------ |\n'
|
||||
'| Infusion | Infusion | 66.7 °C | 60 min | 17.0 L |'
|
||||
)
|
||||
|
||||
assert md_weizen.mash == ''
|
||||
|
||||
|
||||
def test_write_recipes(md_recipes, tmpdir):
|
||||
"""Test write_recipes function."""
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue