Exemplo n.º 1
0
def create_recipe(path):
	expr = Expression(func=getattr(exprfuncs,'expr_test_a'),val=8)
	expr_b = Expression(func=getattr(exprfuncs,'expr_test_b'),val=2)
	row = RecipeRow(a=expr,b=expr_b,c="=")
	assert (row.run(2))
	recipe = Recipe(trigger=Trigger(oncall='test_trigger_a'),name="Dylan")
	recipe.add_row(row)
	recipe.to_file(path) # save it to the path
Exemplo n.º 2
0
def test_save(path):
	expr = Expression(func=getattr(exprfuncs,'expr_test_a'),val=8)

	expr_b = Expression(func=getattr(exprfuncs,'expr_test_b'),val=2)

	row = RecipeRow(a=expr,b=expr_b,c="=")

	assert (row.run(2))

	recipe = Recipe(trigger=Trigger(oncall='test_trigger_a'))
	recipe.add_row(row)
	# portfolio
	portfolio = Portfolio()
	portfolio.add_recipe(recipe)
	portfolio.to_file(path)
	print "file saved"