nac3core: top level test cleanup
This commit is contained in:
parent
b62f5b9376
commit
5cbdb4005c
@ -199,82 +199,7 @@ fn test_simple_function_analyze(source: Vec<&str>, tys: Vec<&str>, names: Vec<&s
|
||||
pass
|
||||
"}
|
||||
],
|
||||
vec![
|
||||
indoc! {"5: Class {
|
||||
name: \"A\",
|
||||
def_id: DefinitionId(5),
|
||||
ancestors: [CustomClassKind { id: DefinitionId(5), params: [] }],
|
||||
fields: [(\"a\", \"class0\")],
|
||||
methods: [(\"__init__\", \"fn[[], class4]\", DefinitionId(6)), (\"fun\", \"fn[[b=class9], class4]\", DefinitionId(7)), (\"foo\", \"fn[[a=tvar2, b=tvar3], class4]\", DefinitionId(8))],
|
||||
type_vars: []
|
||||
}"},
|
||||
|
||||
indoc! {"6: Function {
|
||||
name: \"A.__init__\",
|
||||
sig: \"fn[[], class4]\",
|
||||
var_id: []
|
||||
}"},
|
||||
|
||||
indoc! {"7: Function {
|
||||
name: \"A.fun\",
|
||||
sig: \"fn[[b=class9], class4]\",
|
||||
var_id: []
|
||||
}"},
|
||||
|
||||
indoc! {"8: Function {
|
||||
name: \"A.foo\",
|
||||
sig: \"fn[[a=tvar2, b=tvar3], class4]\",
|
||||
var_id: [2, 3]
|
||||
}"},
|
||||
|
||||
indoc! {"9: Class {
|
||||
name: \"B\",
|
||||
def_id: DefinitionId(9),
|
||||
ancestors: [CustomClassKind { id: DefinitionId(9), params: [] }, CustomClassKind { id: DefinitionId(11), params: [] }, CustomClassKind { id: DefinitionId(5), params: [] }],
|
||||
fields: [(\"a\", \"class0\")],
|
||||
methods: [(\"__init__\", \"fn[[], class4]\", DefinitionId(10)), (\"fun\", \"fn[[b=class9], class4]\", DefinitionId(13)), (\"foo\", \"fn[[a=tvar2, b=tvar3], class4]\", DefinitionId(8))],
|
||||
type_vars: []
|
||||
}"},
|
||||
|
||||
indoc! {"10: Function {
|
||||
name: \"B.__init__\",
|
||||
sig: \"fn[[], class4]\",
|
||||
var_id: []
|
||||
}"},
|
||||
|
||||
indoc! {"11: Class {
|
||||
name: \"C\",
|
||||
def_id: DefinitionId(11),
|
||||
ancestors: [CustomClassKind { id: DefinitionId(11), params: [] }, CustomClassKind { id: DefinitionId(5), params: [] }],
|
||||
fields: [(\"a\", \"class0\")],
|
||||
methods: [(\"__init__\", \"fn[[], class4]\", DefinitionId(12)), (\"fun\", \"fn[[b=class9], class4]\", DefinitionId(13)), (\"foo\", \"fn[[a=tvar2, b=tvar3], class4]\", DefinitionId(8))],
|
||||
type_vars: []
|
||||
}"},
|
||||
|
||||
indoc! {"12: Function {
|
||||
name: \"C.__init__\",
|
||||
sig: \"fn[[], class4]\",
|
||||
var_id: []
|
||||
}"},
|
||||
|
||||
indoc! {"13: Function {
|
||||
name: \"C.fun\",
|
||||
sig: \"fn[[b=class9], class4]\",
|
||||
var_id: []
|
||||
}"},
|
||||
|
||||
indoc! {"14: Function {
|
||||
name: \"foo\",
|
||||
sig: \"fn[[a=class5], class4]\",
|
||||
var_id: []
|
||||
}"},
|
||||
|
||||
indoc! {"15: Function {
|
||||
name: \"ff\",
|
||||
sig: \"fn[[a=tvar2], tvar3]\",
|
||||
var_id: [2, 3]
|
||||
}"},
|
||||
];
|
||||
vec![];
|
||||
"simple class compose"
|
||||
)]
|
||||
#[test_case(
|
||||
@ -296,49 +221,7 @@ fn test_simple_function_analyze(source: Vec<&str>, tys: Vec<&str>, names: Vec<&s
|
||||
pass
|
||||
"}
|
||||
],
|
||||
vec![
|
||||
indoc! {"5: Class {
|
||||
name: \"Generic_A\",
|
||||
def_id: DefinitionId(5),
|
||||
ancestors: [CustomClassKind { id: DefinitionId(5), params: [TypeVarKind(UnificationKey(101))] }, CustomClassKind { id: DefinitionId(8), params: [] }],
|
||||
fields: [(\"aa\", \"class3\"), (\"a\", \"class1\")],
|
||||
methods: [(\"__init__\", \"fn[[], class4]\", DefinitionId(6)), (\"foo\", \"fn[[b=tvar2], class4]\", DefinitionId(10)), (\"fun\", \"fn[[a=class0], tvar3]\", DefinitionId(7))],
|
||||
type_vars: [UnificationKey(101)]
|
||||
}"},
|
||||
|
||||
indoc! {"6: Function {
|
||||
name: \"Generic_A.__init__\",
|
||||
sig: \"fn[[], class4]\",
|
||||
var_id: [3]
|
||||
}"},
|
||||
|
||||
indoc! {"7: Function {
|
||||
name: \"Generic_A.fun\",
|
||||
sig: \"fn[[a=class0], tvar3]\",
|
||||
var_id: [3]
|
||||
}"},
|
||||
|
||||
indoc! {"8: Class {
|
||||
name: \"B\",
|
||||
def_id: DefinitionId(8),
|
||||
ancestors: [CustomClassKind { id: DefinitionId(8), params: [] }],
|
||||
fields: [(\"aa\", \"class3\")],
|
||||
methods: [(\"__init__\", \"fn[[], class4]\", DefinitionId(9)), (\"foo\", \"fn[[b=tvar2], class4]\", DefinitionId(10))],
|
||||
type_vars: []
|
||||
}"},
|
||||
|
||||
indoc! {"9: Function {
|
||||
name: \"B.__init__\",
|
||||
sig: \"fn[[], class4]\",
|
||||
var_id: []
|
||||
}"},
|
||||
|
||||
indoc! {"10: Function {
|
||||
name: \"B.foo\",
|
||||
sig: \"fn[[b=tvar2], class4]\",
|
||||
var_id: [2]
|
||||
}"},
|
||||
];
|
||||
vec![];
|
||||
"generic class"
|
||||
)]
|
||||
#[test_case(
|
||||
@ -367,55 +250,7 @@ fn test_simple_function_analyze(source: Vec<&str>, tys: Vec<&str>, names: Vec<&s
|
||||
pass
|
||||
"}
|
||||
],
|
||||
vec![
|
||||
indoc! {"5: Function {
|
||||
name: \"foo\",
|
||||
sig: \"fn[[a=list[class0], b=tuple[tvar2, class2]], class6[2->class10, 3->class3]]\",
|
||||
var_id: [2]
|
||||
}"},
|
||||
|
||||
indoc! {"6: Class {
|
||||
name: \"A\",
|
||||
def_id: DefinitionId(6),
|
||||
ancestors: [CustomClassKind { id: DefinitionId(6), params: [TypeVarKind(UnificationKey(100)), TypeVarKind(UnificationKey(101))] }],
|
||||
fields: [(\"a\", \"tvar2\"), (\"b\", \"tvar3\")],
|
||||
methods: [(\"__init__\", \"fn[[v=tvar3], class4]\", DefinitionId(7)), (\"fun\", \"fn[[a=tvar2], tvar3]\", DefinitionId(8))],
|
||||
type_vars: [UnificationKey(100), UnificationKey(101)]
|
||||
}"},
|
||||
|
||||
indoc! {"7: Function {
|
||||
name: \"A.__init__\",
|
||||
sig: \"fn[[v=tvar3], class4]\",
|
||||
var_id: [2, 3]
|
||||
}"},
|
||||
|
||||
indoc! {"8: Function {
|
||||
name: \"A.fun\",
|
||||
sig: \"fn[[a=tvar2], tvar3]\",
|
||||
var_id: [2, 3]
|
||||
}"},
|
||||
|
||||
indoc! {"9: Function {
|
||||
name: \"gfun\",
|
||||
sig: \"fn[[a=class6[2->list[class2], 3->class0]], class4]\",
|
||||
var_id: []
|
||||
}"},
|
||||
|
||||
indoc! {"10: Class {
|
||||
name: \"B\",
|
||||
def_id: DefinitionId(10),
|
||||
ancestors: [CustomClassKind { id: DefinitionId(10), params: [] }],
|
||||
fields: [],
|
||||
methods: [(\"__init__\", \"fn[[], class4]\", DefinitionId(11))],
|
||||
type_vars: []
|
||||
}"},
|
||||
|
||||
indoc! {"11: Function {
|
||||
name: \"B.__init__\",
|
||||
sig: \"fn[[], class4]\",
|
||||
var_id: []
|
||||
}"},
|
||||
];
|
||||
vec![];
|
||||
"list tuple generic"
|
||||
)]
|
||||
#[test_case(
|
||||
@ -440,55 +275,7 @@ fn test_simple_function_analyze(source: Vec<&str>, tys: Vec<&str>, names: Vec<&s
|
||||
pass
|
||||
"}
|
||||
],
|
||||
vec![
|
||||
indoc! {"5: Class {
|
||||
name: \"A\",
|
||||
def_id: DefinitionId(5),
|
||||
ancestors: [CustomClassKind { id: DefinitionId(5), params: [TypeVarKind(UnificationKey(100)), TypeVarKind(UnificationKey(101))] }],
|
||||
fields: [(\"a\", \"class5[2->class2, 3->class3]\"), (\"b\", \"class8\")],
|
||||
methods: [(\"__init__\", \"fn[[a=class5[2->class2, 3->class3], b=class8], class4]\", DefinitionId(6)), (\"fun\", \"fn[[a=class5[2->class2, 3->class3]], class5[2->class3, 3->class0]]\", DefinitionId(7))],
|
||||
type_vars: [UnificationKey(100), UnificationKey(101)]
|
||||
}"},
|
||||
|
||||
indoc! {"6: Function {
|
||||
name: \"A.__init__\",
|
||||
sig: \"fn[[a=class5[2->class2, 3->class3], b=class8], class4]\",
|
||||
var_id: [2, 3]
|
||||
}"},
|
||||
|
||||
indoc! {"7: Function {
|
||||
name: \"A.fun\",
|
||||
sig: \"fn[[a=class5[2->class2, 3->class3]], class5[2->class3, 3->class0]]\",
|
||||
var_id: [2, 3]
|
||||
}"},
|
||||
|
||||
indoc! {"8: Class {
|
||||
name: \"B\",
|
||||
def_id: DefinitionId(8),
|
||||
ancestors: [CustomClassKind { id: DefinitionId(8), params: [] }, CustomClassKind { id: DefinitionId(5), params: [PrimitiveKind(UnificationKey(1)), PrimitiveKind(UnificationKey(3))] }],
|
||||
fields: [(\"a\", \"class5[2->class2, 3->class3]\"), (\"b\", \"class8\")],
|
||||
methods: [(\"__init__\", \"fn[[], class4]\", DefinitionId(9)), (\"fun\", \"fn[[a=class5[2->class2, 3->class3]], class5[2->class3, 3->class0]]\", DefinitionId(7)), (\"foo\", \"fn[[b=class8], class8]\", DefinitionId(10)), (\"bar\", \"fn[[a=class5[2->list[class8], 3->class0]], tuple[class5[2->virtual[class5[2->class8, 3->class0]], 3->class3], class8]]\", DefinitionId(11))],
|
||||
type_vars: []
|
||||
}"},
|
||||
|
||||
indoc! {"9: Function {
|
||||
name: \"B.__init__\",
|
||||
sig: \"fn[[], class4]\",
|
||||
var_id: []
|
||||
}"},
|
||||
|
||||
indoc! {"10: Function {
|
||||
name: \"B.foo\",
|
||||
sig: \"fn[[b=class8], class8]\",
|
||||
var_id: []
|
||||
}"},
|
||||
|
||||
indoc! {"11: Function {
|
||||
name: \"B.bar\",
|
||||
sig: \"fn[[a=class5[2->list[class8], 3->class0]], tuple[class5[2->virtual[class5[2->class8, 3->class0]], 3->class3], class8]]\",
|
||||
var_id: []
|
||||
}"},
|
||||
];
|
||||
vec![];
|
||||
"self1"
|
||||
)]
|
||||
#[test_case(
|
||||
@ -522,70 +309,7 @@ fn test_simple_function_analyze(source: Vec<&str>, tys: Vec<&str>, names: Vec<&s
|
||||
pass
|
||||
"}
|
||||
],
|
||||
vec![
|
||||
indoc! {"5: Class {
|
||||
name: \"A\",
|
||||
def_id: DefinitionId(5),
|
||||
ancestors: [CustomClassKind { id: DefinitionId(5), params: [TypeVarKind(UnificationKey(100))] }],
|
||||
fields: [(\"a\", \"class0\"), (\"b\", \"tvar2\"), (\"c\", \"class5[2->class1]\")],
|
||||
methods: [(\"__init__\", \"fn[[t=tvar2], class4]\", DefinitionId(6)), (\"fun\", \"fn[[a=class0, b=tvar2], list[virtual[class9[3->class3]]]]\", DefinitionId(7)), (\"foo\", \"fn[[c=class12], class4]\", DefinitionId(8))],
|
||||
type_vars: [UnificationKey(100)]
|
||||
}"},
|
||||
|
||||
indoc! {"6: Function {
|
||||
name: \"A.__init__\",
|
||||
sig: \"fn[[t=tvar2], class4]\",
|
||||
var_id: [2]
|
||||
}"},
|
||||
|
||||
indoc! {"7: Function {
|
||||
name: \"A.fun\",
|
||||
sig: \"fn[[a=class0, b=tvar2], list[virtual[class9[3->class3]]]]\",
|
||||
var_id: [2]
|
||||
}"},
|
||||
|
||||
indoc! {"8: Function {
|
||||
name: \"A.foo\",
|
||||
sig: \"fn[[c=class12], class4]\",
|
||||
var_id: [2]
|
||||
}"},
|
||||
|
||||
indoc! {"9: Class {
|
||||
name: \"B\",
|
||||
def_id: DefinitionId(9),
|
||||
ancestors: [CustomClassKind { id: DefinitionId(9), params: [TypeVarKind(UnificationKey(101))] }, CustomClassKind { id: DefinitionId(5), params: [PrimitiveKind(UnificationKey(2))] }],
|
||||
fields: [(\"a\", \"class0\"), (\"b\", \"tvar2\"), (\"c\", \"class5[2->class1]\"), (\"d\", \"class12\")],
|
||||
methods: [(\"__init__\", \"fn[[], class4]\", DefinitionId(10)), (\"fun\", \"fn[[a=class0, b=tvar2], list[virtual[class9[3->class3]]]]\", DefinitionId(11)), (\"foo\", \"fn[[c=class12], class4]\", DefinitionId(8))],
|
||||
type_vars: [UnificationKey(101)]
|
||||
}"},
|
||||
|
||||
indoc! {"10: Function {
|
||||
name: \"B.__init__\",
|
||||
sig: \"fn[[], class4]\",
|
||||
var_id: [3]
|
||||
}"},
|
||||
|
||||
indoc! {"11: Function {
|
||||
name: \"B.fun\",
|
||||
sig: \"fn[[a=class0, b=tvar2], list[virtual[class9[3->class3]]]]\",
|
||||
var_id: [2, 3]
|
||||
}"},
|
||||
|
||||
indoc! {"12: Class {
|
||||
name: \"C\",
|
||||
def_id: DefinitionId(12),
|
||||
ancestors: [CustomClassKind { id: DefinitionId(12), params: [] }, CustomClassKind { id: DefinitionId(9), params: [PrimitiveKind(UnificationKey(3))] }, CustomClassKind { id: DefinitionId(5), params: [PrimitiveKind(UnificationKey(2))] }],
|
||||
fields: [(\"a\", \"class0\"), (\"b\", \"tvar2\"), (\"c\", \"class5[2->class1]\"), (\"d\", \"class12\"), (\"e\", \"class1\")],
|
||||
methods: [(\"__init__\", \"fn[[], class4]\", DefinitionId(13)), (\"fun\", \"fn[[a=class0, b=tvar2], list[virtual[class9[3->class3]]]]\", DefinitionId(11)), (\"foo\", \"fn[[c=class12], class4]\", DefinitionId(8))],
|
||||
type_vars: []
|
||||
}"},
|
||||
|
||||
indoc! {"13: Function {
|
||||
name: \"C.__init__\",
|
||||
sig: \"fn[[], class4]\",
|
||||
var_id: []
|
||||
}"},
|
||||
];
|
||||
vec![];
|
||||
"inheritance_override"
|
||||
)]
|
||||
#[test_case(
|
||||
|
Loading…
Reference in New Issue
Block a user