mirror of
https://github.com/RustPython/Parser.git
synced 2025-07-07 21:25:31 +00:00
Add bound to test case test_parse_class_with_all_possible_generic_types
This commit is contained in:
parent
b06b2662c9
commit
e0a8f5b7b3
2 changed files with 19 additions and 9 deletions
|
@ -701,7 +701,7 @@ class Foo[**P](A, B):
|
||||||
#[cfg(feature = "all-nodes-with-ranges")]
|
#[cfg(feature = "all-nodes-with-ranges")]
|
||||||
fn test_parse_class_with_all_possible_generic_types() {
|
fn test_parse_class_with_all_possible_generic_types() {
|
||||||
let source = "\
|
let source = "\
|
||||||
class Foo[X, Y, *U, **P](A, B):
|
class Foo[X, Y: str, *U, **P](A, B):
|
||||||
pass
|
pass
|
||||||
";
|
";
|
||||||
insta::assert_debug_snapshot!(ast::Suite::parse(source, "<test>").unwrap());
|
insta::assert_debug_snapshot!(ast::Suite::parse(source, "<test>").unwrap());
|
||||||
|
|
|
@ -5,14 +5,14 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
|
||||||
[
|
[
|
||||||
ClassDef(
|
ClassDef(
|
||||||
StmtClassDef {
|
StmtClassDef {
|
||||||
range: 0..38,
|
range: 0..43,
|
||||||
name: Identifier(
|
name: Identifier(
|
||||||
"Foo",
|
"Foo",
|
||||||
),
|
),
|
||||||
bases: [
|
bases: [
|
||||||
Name(
|
Name(
|
||||||
ExprName {
|
ExprName {
|
||||||
range: 25..26,
|
range: 30..31,
|
||||||
id: Identifier(
|
id: Identifier(
|
||||||
"A",
|
"A",
|
||||||
),
|
),
|
||||||
|
@ -21,7 +21,7 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
|
||||||
),
|
),
|
||||||
Name(
|
Name(
|
||||||
ExprName {
|
ExprName {
|
||||||
range: 28..29,
|
range: 33..34,
|
||||||
id: Identifier(
|
id: Identifier(
|
||||||
"B",
|
"B",
|
||||||
),
|
),
|
||||||
|
@ -33,7 +33,7 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
|
||||||
body: [
|
body: [
|
||||||
Pass(
|
Pass(
|
||||||
StmtPass {
|
StmtPass {
|
||||||
range: 34..38,
|
range: 39..43,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -50,16 +50,26 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
|
||||||
),
|
),
|
||||||
TypeVar(
|
TypeVar(
|
||||||
TypeParamTypeVar {
|
TypeParamTypeVar {
|
||||||
range: 13..14,
|
range: 13..19,
|
||||||
name: Identifier(
|
name: Identifier(
|
||||||
"Y",
|
"Y",
|
||||||
),
|
),
|
||||||
bound: None,
|
bound: Some(
|
||||||
|
Name(
|
||||||
|
ExprName {
|
||||||
|
range: 16..19,
|
||||||
|
id: Identifier(
|
||||||
|
"str",
|
||||||
|
),
|
||||||
|
ctx: Load,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
TypeVarTuple(
|
TypeVarTuple(
|
||||||
TypeParamTypeVarTuple {
|
TypeParamTypeVarTuple {
|
||||||
range: 16..18,
|
range: 21..23,
|
||||||
name: Identifier(
|
name: Identifier(
|
||||||
"U",
|
"U",
|
||||||
),
|
),
|
||||||
|
@ -67,7 +77,7 @@ expression: "ast::Suite::parse(source, \"<test>\").unwrap()"
|
||||||
),
|
),
|
||||||
ParamSpec(
|
ParamSpec(
|
||||||
TypeParamParamSpec {
|
TypeParamParamSpec {
|
||||||
range: 20..23,
|
range: 25..28,
|
||||||
name: Identifier(
|
name: Identifier(
|
||||||
"P",
|
"P",
|
||||||
),
|
),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue