mirror of
https://github.com/shouptech/synthale.git
synced 2026-02-03 15:39:45 +00:00
Add table for yeast
This commit is contained in:
parent
89174a2838
commit
398b488038
2 changed files with 32 additions and 0 deletions
|
|
@ -67,6 +67,8 @@ class MarkdownRecipe:
|
|||
'',
|
||||
self.hops,
|
||||
'',
|
||||
self.yeast,
|
||||
'',
|
||||
))
|
||||
|
||||
@property
|
||||
|
|
@ -176,6 +178,25 @@ class MarkdownRecipe:
|
|||
)
|
||||
)
|
||||
|
||||
@property
|
||||
def yeast(self):
|
||||
"""Return markdown to represent the recipe's yeast."""
|
||||
headers = ('Name', 'Lab', 'Type', 'Attenuation')
|
||||
rows = []
|
||||
for yeast in self.recipe.yeasts:
|
||||
rows.append((
|
||||
yeast.name,
|
||||
yeast.laboratory,
|
||||
yeast.type,
|
||||
'{:.1f} %'.format(yeast.attenuation),
|
||||
))
|
||||
return (
|
||||
'{}\n{}'.format(
|
||||
markdown.setext_heading('Yeast', level=2),
|
||||
markdown.table(headers, rows)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def load_file(path):
|
||||
"""Parse BeerXML file located at `path`.
|
||||
|
|
|
|||
|
|
@ -129,6 +129,17 @@ def test_recipe_hops(md_weizen):
|
|||
assert '| 28.3 g |' in md_weizen.hops
|
||||
|
||||
|
||||
def test_recipe_yeast(md_weizen):
|
||||
"""Test valid yeast table is generated."""
|
||||
assert md_weizen.yeast == (
|
||||
'Yeast\n'
|
||||
'-----\n'
|
||||
'| Name | Lab | Type | Attenuation |\n'
|
||||
'| ------------- | --------- | ---- | ----------- |\n'
|
||||
'| Safbrew WB-06 | Fermentis | Ale | 70.0 % |'
|
||||
)
|
||||
|
||||
|
||||
def test_write_recipes(md_recipes, tmpdir):
|
||||
"""Test write_recipes function."""
|
||||
write_recipes(md_recipes, str(tmpdir))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue