55from mypy .constraints import SUBTYPE_OF , SUPERTYPE_OF , Constraint , infer_constraints
66from mypy .test .helpers import Suite
77from mypy .test .typefixture import TypeFixture
8- from mypy .types import Instance , TupleType , TypeList , UnpackType
8+ from mypy .types import Instance , TupleType , UnpackType
99
1010
1111class ConstraintsSuite (Suite ):
@@ -27,13 +27,19 @@ def test_basic_type_var_tuple_subtype(self) -> None:
2727 fx = self .fx
2828 assert infer_constraints (
2929 Instance (fx .gvi , [UnpackType (fx .ts )]), Instance (fx .gvi , [fx .a , fx .b ]), SUBTYPE_OF
30- ) == [Constraint (type_var = fx .ts , op = SUBTYPE_OF , target = TypeList ([fx .a , fx .b ]))]
30+ ) == [
31+ Constraint (type_var = fx .ts , op = SUBTYPE_OF , target = TupleType ([fx .a , fx .b ], fx .std_tuple ))
32+ ]
3133
3234 def test_basic_type_var_tuple (self ) -> None :
3335 fx = self .fx
3436 assert infer_constraints (
3537 Instance (fx .gvi , [UnpackType (fx .ts )]), Instance (fx .gvi , [fx .a , fx .b ]), SUPERTYPE_OF
36- ) == [Constraint (type_var = fx .ts , op = SUPERTYPE_OF , target = TypeList ([fx .a , fx .b ]))]
38+ ) == [
39+ Constraint (
40+ type_var = fx .ts , op = SUPERTYPE_OF , target = TupleType ([fx .a , fx .b ], fx .std_tuple )
41+ )
42+ ]
3743
3844 def test_type_var_tuple_with_prefix_and_suffix (self ) -> None :
3945 fx = self .fx
@@ -45,7 +51,9 @@ def test_type_var_tuple_with_prefix_and_suffix(self) -> None:
4551 )
4652 ) == {
4753 Constraint (type_var = fx .t , op = SUPERTYPE_OF , target = fx .a ),
48- Constraint (type_var = fx .ts , op = SUPERTYPE_OF , target = TypeList ([fx .b , fx .c ])),
54+ Constraint (
55+ type_var = fx .ts , op = SUPERTYPE_OF , target = TupleType ([fx .b , fx .c ], fx .std_tuple )
56+ ),
4957 Constraint (type_var = fx .s , op = SUPERTYPE_OF , target = fx .d ),
5058 }
5159
0 commit comments