def test_compiler_function_block(patch, compiler, lines, tree): patch.object(Objects, 'function_arguments') patch.many(JSONCompiler, ['subtree', 'function_output']) compiler.function_block(tree, '1') statement = tree.function_statement Objects.function_arguments.assert_called_with(statement) compiler.function_output.assert_called_with(statement) lines.append.assert_called_with('function', tree.line(), function=statement.child().value, args=Objects.function_arguments(), output=compiler.function_output(), enter=tree.nested_block.line(), parent='1') compiler.subtree.assert_called_with(tree.nested_block, parent=tree.line())
def test_compiler_function_block(patch, compiler, lines, tree): patch.object(Objects, "function_arguments") patch.many(JSONCompiler, ["subtree", "function_output"]) compiler.function_block(tree, "1") statement = tree.function_statement Objects.function_arguments.assert_called_with(statement) compiler.function_output.assert_called_with(statement) lines.append.assert_called_with( "function", tree.position(), function=statement.child().value, args=Objects.function_arguments(), output=compiler.function_output(), enter=tree.nested_block.line(), parent="1", ) compiler.subtree.assert_called_with( tree.nested_block, parent=tree.position().line )