コード例 #1
0
def test_exceptions_storyerror_compile_template_tree(patch, error):
    patch.object(StoryError, 'tree_template')
    error.item.data = 'data'
    result = error.compile_template()
    args = (error.item, error.item.line())
    StoryError.tree_template.assert_called_with(*args)
    assert result == StoryError.tree_template()
コード例 #2
0
def test_exceptions_storyerror_compile_template_dict(patch, error):
    """
    Ensures compile_template can handle dictionary items.
    """
    patch.object(StoryError, 'tree_template')
    error.item = {'value': 'value', 'line': '1'}
    result = error.compile_template()
    StoryError.tree_template.assert_called_with('value', '1')
    assert result == StoryError.tree_template()