def test_result_format_template_from_context(): res = Result(location="{this}/{works}/yes?") with prefect.context(this="indeed", works="functional"): new = res.format(**prefect.context) assert new.location == "indeed/functional/yes?" assert res.location == "{this}/{works}/yes?" assert new != res
def test_result_render_fails_on_no_template_given(): with pytest.raises(ValueError): res = Result() res.format()
def test_result_format_template_from_context(): res = Result(filepath_template="{this}/{works}/yes?") with prefect.context(this="indeed", works="functional"): new = res.format(**prefect.context) assert new._rendered_filepath == "indeed/functional/yes?" assert res._rendered_filepath == None