extern crate pythonic; use pythonic::{Argument, Block, Function, Statement}; fn main() { let mut program = Block::new(); let mut function = Function::new("hello", vec![Argument::new("name", Some("\"World\""), Some("str"), Some("The name to say Hello to"))], &program); let arguments = vec![Statement::unnamed_variable("Hello"), Statement::variable("name")]; let function_call = Statement::function_call("print", arguments); function.add_statement(function_call); function.add_docstring("hello is a function that prints \"Hello\" with the given \ name argument."); program.add_function(function); let function_call = Statement::function_call( "hello", vec![ Statement::unnamed_variable("Chris") ]); program.add_statement(function_call); let expected = r#"def hello(name="World"): """ hello is a function that prints "Hello" with the given name argument. :param name: str The name to say Hello to """ print("Hello", name) hello("Chris") "#; let actual = format!("{}",program); assert_eq!(expected, actual); println!("{}", actual); }