From 027db8f2424abfbf24922acb721506f55b45b21f Mon Sep 17 00:00:00 2001 From: Zanie Date: Thu, 13 Jul 2023 14:19:25 -0500 Subject: [PATCH] Commit snapshot --- ...ser__tests__parse_function_definition.snap | 560 ++++++++++++++++++ 1 file changed, 560 insertions(+) create mode 100644 parser/src/snapshots/rustpython_parser__parser__tests__parse_function_definition.snap diff --git a/parser/src/snapshots/rustpython_parser__parser__tests__parse_function_definition.snap b/parser/src/snapshots/rustpython_parser__parser__tests__parse_function_definition.snap new file mode 100644 index 0000000..2d65a64 --- /dev/null +++ b/parser/src/snapshots/rustpython_parser__parser__tests__parse_function_definition.snap @@ -0,0 +1,560 @@ +--- +source: parser/src/parser.rs +expression: "ast::Suite::parse(source, \"\").unwrap()" +--- +[ + FunctionDef( + StmtFunctionDef { + range: 0..20, + name: Identifier( + "func", + ), + args: Arguments { + range: 9..10, + posonlyargs: [], + args: [ + ArgWithDefault { + range: 9..10, + def: Arg { + range: 9..10, + arg: Identifier( + "a", + ), + annotation: None, + type_comment: None, + }, + default: None, + }, + ], + vararg: None, + kwonlyargs: [], + kwarg: None, + }, + body: [ + Expr( + StmtExpr { + range: 17..20, + value: Constant( + ExprConstant { + range: 17..20, + value: Ellipsis, + kind: None, + }, + ), + }, + ), + ], + decorator_list: [], + returns: None, + type_comment: None, + type_params: [], + }, + ), + FunctionDef( + StmtFunctionDef { + range: 22..53, + name: Identifier( + "func", + ), + args: Arguments { + range: 34..38, + posonlyargs: [], + args: [ + ArgWithDefault { + range: 34..38, + def: Arg { + range: 34..38, + arg: Identifier( + "a", + ), + annotation: Some( + Name( + ExprName { + range: 37..38, + id: Identifier( + "T", + ), + ctx: Load, + }, + ), + ), + type_comment: None, + }, + default: None, + }, + ], + vararg: None, + kwonlyargs: [], + kwarg: None, + }, + body: [ + Expr( + StmtExpr { + range: 50..53, + value: Constant( + ExprConstant { + range: 50..53, + value: Ellipsis, + kind: None, + }, + ), + }, + ), + ], + decorator_list: [], + returns: Some( + Name( + ExprName { + range: 43..44, + id: Identifier( + "T", + ), + ctx: Load, + }, + ), + ), + type_comment: None, + type_params: [ + TypeVar( + TypeParamTypeVar { + range: 31..32, + name: Identifier( + "T", + ), + bound: None, + }, + ), + ], + }, + ), + FunctionDef( + StmtFunctionDef { + range: 55..91, + name: Identifier( + "func", + ), + args: Arguments { + range: 72..76, + posonlyargs: [], + args: [ + ArgWithDefault { + range: 72..76, + def: Arg { + range: 72..76, + arg: Identifier( + "a", + ), + annotation: Some( + Name( + ExprName { + range: 75..76, + id: Identifier( + "T", + ), + ctx: Load, + }, + ), + ), + type_comment: None, + }, + default: None, + }, + ], + vararg: None, + kwonlyargs: [], + kwarg: None, + }, + body: [ + Expr( + StmtExpr { + range: 88..91, + value: Constant( + ExprConstant { + range: 88..91, + value: Ellipsis, + kind: None, + }, + ), + }, + ), + ], + decorator_list: [], + returns: Some( + Name( + ExprName { + range: 81..82, + id: Identifier( + "T", + ), + ctx: Load, + }, + ), + ), + type_comment: None, + type_params: [ + TypeVar( + TypeParamTypeVar { + range: 64..70, + name: Identifier( + "T", + ), + bound: Some( + Name( + ExprName { + range: 67..70, + id: Identifier( + "str", + ), + ctx: Load, + }, + ), + ), + }, + ), + ], + }, + ), + FunctionDef( + StmtFunctionDef { + range: 93..138, + name: Identifier( + "func", + ), + args: Arguments { + range: 119..123, + posonlyargs: [], + args: [ + ArgWithDefault { + range: 119..123, + def: Arg { + range: 119..123, + arg: Identifier( + "a", + ), + annotation: Some( + Name( + ExprName { + range: 122..123, + id: Identifier( + "T", + ), + ctx: Load, + }, + ), + ), + type_comment: None, + }, + default: None, + }, + ], + vararg: None, + kwonlyargs: [], + kwarg: None, + }, + body: [ + Expr( + StmtExpr { + range: 135..138, + value: Constant( + ExprConstant { + range: 135..138, + value: Ellipsis, + kind: None, + }, + ), + }, + ), + ], + decorator_list: [], + returns: Some( + Name( + ExprName { + range: 128..129, + id: Identifier( + "T", + ), + ctx: Load, + }, + ), + ), + type_comment: None, + type_params: [ + TypeVar( + TypeParamTypeVar { + range: 102..117, + name: Identifier( + "T", + ), + bound: Some( + Tuple( + ExprTuple { + range: 105..117, + elts: [ + Name( + ExprName { + range: 106..109, + id: Identifier( + "str", + ), + ctx: Load, + }, + ), + Name( + ExprName { + range: 111..116, + id: Identifier( + "bytes", + ), + ctx: Load, + }, + ), + ], + ctx: Load, + }, + ), + ), + }, + ), + ], + }, + ), + FunctionDef( + StmtFunctionDef { + range: 140..171, + name: Identifier( + "func", + ), + args: Arguments { + range: 154..161, + posonlyargs: [], + args: [], + vararg: Some( + Arg { + range: 155..161, + arg: Identifier( + "a", + ), + annotation: Some( + Starred( + ExprStarred { + range: 158..161, + value: Name( + ExprName { + range: 159..161, + id: Identifier( + "Ts", + ), + ctx: Load, + }, + ), + ctx: Load, + }, + ), + ), + type_comment: None, + }, + ), + kwonlyargs: [], + kwarg: None, + }, + body: [ + Expr( + StmtExpr { + range: 168..171, + value: Constant( + ExprConstant { + range: 168..171, + value: Ellipsis, + kind: None, + }, + ), + }, + ), + ], + decorator_list: [], + returns: None, + type_comment: None, + type_params: [ + TypeVarTuple( + TypeParamTypeVarTuple { + range: 149..152, + name: Identifier( + "Ts", + ), + }, + ), + ], + }, + ), + FunctionDef( + StmtFunctionDef { + range: 173..230, + name: Identifier( + "func", + ), + args: Arguments { + range: 187..220, + posonlyargs: [], + args: [], + vararg: Some( + Arg { + range: 188..200, + arg: Identifier( + "args", + ), + annotation: Some( + Attribute( + ExprAttribute { + range: 194..200, + value: Name( + ExprName { + range: 194..195, + id: Identifier( + "P", + ), + ctx: Load, + }, + ), + attr: Identifier( + "args", + ), + ctx: Load, + }, + ), + ), + type_comment: None, + }, + ), + kwonlyargs: [], + kwarg: Some( + Arg { + range: 204..220, + arg: Identifier( + "kwargs", + ), + annotation: Some( + Attribute( + ExprAttribute { + range: 212..220, + value: Name( + ExprName { + range: 212..213, + id: Identifier( + "P", + ), + ctx: Load, + }, + ), + attr: Identifier( + "kwargs", + ), + ctx: Load, + }, + ), + ), + type_comment: None, + }, + ), + }, + body: [ + Expr( + StmtExpr { + range: 227..230, + value: Constant( + ExprConstant { + range: 227..230, + value: Ellipsis, + kind: None, + }, + ), + }, + ), + ], + decorator_list: [], + returns: None, + type_comment: None, + type_params: [ + ParamSpec( + TypeParamParamSpec { + range: 182..185, + name: Identifier( + "P", + ), + }, + ), + ], + }, + ), + FunctionDef( + StmtFunctionDef { + range: 232..273, + name: Identifier( + "func", + ), + args: Arguments { + range: 261..263, + posonlyargs: [], + args: [], + vararg: None, + kwonlyargs: [], + kwarg: None, + }, + body: [ + Pass( + StmtPass { + range: 269..273, + }, + ), + ], + decorator_list: [], + returns: None, + type_comment: None, + type_params: [ + TypeVar( + TypeParamTypeVar { + range: 241..242, + name: Identifier( + "T", + ), + bound: None, + }, + ), + TypeVar( + TypeParamTypeVar { + range: 244..250, + name: Identifier( + "U", + ), + bound: Some( + Name( + ExprName { + range: 247..250, + id: Identifier( + "str", + ), + ctx: Load, + }, + ), + ), + }, + ), + TypeVarTuple( + TypeParamTypeVarTuple { + range: 252..255, + name: Identifier( + "Ts", + ), + }, + ), + ParamSpec( + TypeParamParamSpec { + range: 257..260, + name: Identifier( + "P", + ), + }, + ), + ], + }, + ), +]