@@ -30,13 +30,18 @@ def test_basic_type_var_tuple_subtype(self) -> None:
30
30
31
31
def test_basic_type_var_tuple (self ) -> None :
32
32
fx = self .fx
33
- assert infer_constraints (
34
- Instance (fx .gvi , [UnpackType (fx .ts )]), Instance (fx .gvi , [fx .a , fx .b ]), SUPERTYPE_OF
35
- ) == [
33
+ assert set (
34
+ infer_constraints (
35
+ Instance (fx .gvi , [UnpackType (fx .ts )]), Instance (fx .gvi , [fx .a , fx .b ]), SUPERTYPE_OF
36
+ )
37
+ ) == {
36
38
Constraint (
37
39
type_var = fx .ts , op = SUPERTYPE_OF , target = TupleType ([fx .a , fx .b ], fx .std_tuple )
38
- )
39
- ]
40
+ ),
41
+ Constraint (
42
+ type_var = fx .ts , op = SUBTYPE_OF , target = TupleType ([fx .a , fx .b ], fx .std_tuple )
43
+ ),
44
+ }
40
45
41
46
def test_type_var_tuple_with_prefix_and_suffix (self ) -> None :
42
47
fx = self .fx
@@ -51,6 +56,9 @@ def test_type_var_tuple_with_prefix_and_suffix(self) -> None:
51
56
Constraint (
52
57
type_var = fx .ts , op = SUPERTYPE_OF , target = TupleType ([fx .b , fx .c ], fx .std_tuple )
53
58
),
59
+ Constraint (
60
+ type_var = fx .ts , op = SUBTYPE_OF , target = TupleType ([fx .b , fx .c ], fx .std_tuple )
61
+ ),
54
62
Constraint (type_var = fx .s , op = SUPERTYPE_OF , target = fx .d ),
55
63
}
56
64
@@ -64,7 +72,9 @@ def test_unpack_homogenous_tuple(self) -> None:
64
72
)
65
73
) == {
66
74
Constraint (type_var = fx .t , op = SUPERTYPE_OF , target = fx .a ),
75
+ Constraint (type_var = fx .t , op = SUBTYPE_OF , target = fx .a ),
67
76
Constraint (type_var = fx .t , op = SUPERTYPE_OF , target = fx .b ),
77
+ Constraint (type_var = fx .t , op = SUBTYPE_OF , target = fx .b ),
68
78
}
69
79
70
80
def test_unpack_homogenous_tuple_with_prefix_and_suffix (self ) -> None :
@@ -78,7 +88,9 @@ def test_unpack_homogenous_tuple_with_prefix_and_suffix(self) -> None:
78
88
) == {
79
89
Constraint (type_var = fx .t , op = SUPERTYPE_OF , target = fx .a ),
80
90
Constraint (type_var = fx .s , op = SUPERTYPE_OF , target = fx .b ),
91
+ Constraint (type_var = fx .s , op = SUBTYPE_OF , target = fx .b ),
81
92
Constraint (type_var = fx .s , op = SUPERTYPE_OF , target = fx .c ),
93
+ Constraint (type_var = fx .s , op = SUBTYPE_OF , target = fx .c ),
82
94
Constraint (type_var = fx .u , op = SUPERTYPE_OF , target = fx .d ),
83
95
}
84
96
@@ -93,7 +105,9 @@ def test_unpack_with_prefix_and_suffix(self) -> None:
93
105
) == {
94
106
Constraint (type_var = fx .u , op = SUPERTYPE_OF , target = fx .a ),
95
107
Constraint (type_var = fx .t , op = SUPERTYPE_OF , target = fx .b ),
108
+ Constraint (type_var = fx .t , op = SUBTYPE_OF , target = fx .b ),
96
109
Constraint (type_var = fx .s , op = SUPERTYPE_OF , target = fx .c ),
110
+ Constraint (type_var = fx .s , op = SUBTYPE_OF , target = fx .c ),
97
111
Constraint (type_var = fx .u , op = SUPERTYPE_OF , target = fx .d ),
98
112
}
99
113
0 commit comments