Skip to content

Commit 5ef8643

Browse files
authored
Update conformance test sources to allow some errors in additional positions (#1807)
* update conformance tests to initialize uninitialized variables * remove unnecessary __init__ methods * remove __init__ parameter for ClassC in annotations_forward_refs * allow errors on more lines
1 parent 01a3dd5 commit 5ef8643

11 files changed

+24
-34
lines changed

conformance/results/mypy/generics_variance.toml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,9 @@ generics_variance.py:131: error: Variance of TypeVar "T_contra" incompatible wit
1414
conformance_automated = "Fail"
1515
errors_diff = """
1616
Line 113: Expected 1 errors
17-
Line 126: Expected 1 errors
18-
Line 132: Expected 1 errors
19-
Line 142: Expected 1 errors
2017
Line 163: Expected 1 errors
2118
Line 167: Expected 1 errors
2219
Line 191: Expected 1 errors
23-
Line 196: Expected 1 errors
24-
Line 125: Unexpected errors ['generics_variance.py:125: error: Variance of TypeVar "T_co" incompatible with variance in parent type [type-var]']
25-
Line 131: Unexpected errors ['generics_variance.py:131: error: Variance of TypeVar "T_contra" incompatible with variance in parent type [type-var]']
20+
Lines 141, 142: Expected error (tag 'CoContra_Child5')
21+
Lines 195, 196: Expected error (tag 'ContraToContraToContra_WithTA')
2622
"""

conformance/results/mypy/tuples_unpacked.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ errors_diff = """
1111
Line 40: Expected 1 errors
1212
Line 41: Expected 1 errors
1313
Line 51: Expected 1 errors
14-
Line 61: Expected 1 errors
14+
Lines 60, 61: Expected error (tag 't14')
1515
"""

conformance/results/pyre/generics_variance.toml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,9 @@ conformance_automated = "Fail"
1515
errors_diff = """
1616
Line 14: Expected 1 errors
1717
Line 113: Expected 1 errors
18-
Line 126: Expected 1 errors
19-
Line 132: Expected 1 errors
20-
Line 142: Expected 1 errors
2118
Line 163: Expected 1 errors
2219
Line 167: Expected 1 errors
2320
Line 191: Expected 1 errors
24-
Line 196: Expected 1 errors
25-
Line 125: Unexpected errors ['generics_variance.py:125:0 Invalid type variance [46]: The type variable `Variable[T_co](covariant)` is incompatible with parent class type variable `Variable[T_contra](contravariant)` because subclasses cannot use more permissive type variables than their superclasses.']
26-
Line 131: Unexpected errors ['generics_variance.py:131:0 Invalid type variance [46]: The type variable `Variable[T_contra](contravariant)` is incompatible with parent class type variable `Variable[T_co](covariant)` because subclasses cannot use more permissive type variables than their superclasses.']
21+
Lines 141, 142: Expected error (tag 'CoContra_Child5')
22+
Lines 195, 196: Expected error (tag 'ContraToContraToContra_WithTA')
2723
"""

conformance/results/pyre/tuples_unpacked.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ tuples_unpacked.py:60:5 Invalid type [31]: Expression `tuple[(typing.Unpack[tupl
2121
"""
2222
conformance_automated = "Fail"
2323
errors_diff = """
24-
Line 61: Expected 1 errors
2524
Line 16: Unexpected errors ['tuples_unpacked.py:16:13 Invalid type [31]: Expression `tuple[(int, *tuple[(bool, bool)], str)]` is not a valid type.']
2625
Line 18: Unexpected errors ['tuples_unpacked.py:18:19 Invalid type [31]: Expression `tuple[(*tuple[(int, bool)], bool, str)]` is not a valid type.']
2726
Line 19: Unexpected errors ['tuples_unpacked.py:19:19 Invalid type [31]: Expression `tuple[(int, bool, *tuple[(bool, str)])]` is not a valid type.']
@@ -32,5 +31,4 @@ Line 38: Unexpected errors ['tuples_unpacked.py:38:4 Invalid type [31]: Expressi
3231
Line 39: Unexpected errors ['tuples_unpacked.py:39:4 Invalid type [31]: Expression `tuple[(*tuple[(str, *tuple[(str, ...)])])]` is not a valid type.']
3332
Line 49: Unexpected errors ['tuples_unpacked.py:49:13 Invalid type [31]: Expression `tuple[(*Ts)]` is not a valid type.']
3433
Line 50: Unexpected errors ['tuples_unpacked.py:50:8 Invalid type [31]: Expression `tuple[(*tuple[str], *Ts)]` is not a valid type.']
35-
Line 60: Unexpected errors ['tuples_unpacked.py:60:5 Invalid type [31]: Expression `tuple[(typing.Unpack[tuple[(str, typing.Unpack[tuple[(str, ...)]])]], typing.Unpack[tuple[(int, ...)]])]` is not a valid type.']
3634
"""

conformance/results/pyre/version.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
version = "pyre 0.9.22"
2-
test_duration = 1.7
2+
test_duration = 1.6

conformance/results/pytype/generics_variance.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ Line 81: Expected 1 errors
1717
Line 93: Expected 1 errors
1818
Line 105: Expected 1 errors
1919
Line 113: Expected 1 errors
20-
Line 126: Expected 1 errors
21-
Line 132: Expected 1 errors
22-
Line 142: Expected 1 errors
2320
Line 163: Expected 1 errors
2421
Line 167: Expected 1 errors
2522
Line 191: Expected 1 errors
26-
Line 196: Expected 1 errors
23+
Lines 125, 126: Expected error (tag 'CoContra_Child2')
24+
Lines 131, 132: Expected error (tag 'CoContra_Child3')
25+
Lines 141, 142: Expected error (tag 'CoContra_Child5')
26+
Lines 195, 196: Expected error (tag 'ContraToContraToContra_WithTA')
2727
Line 18: Unexpected errors ['File "generics_variance.py", line 18, in <module>: argument "covariant" to TypeVar not supported yet [not-supported-yet]']
2828
Line 19: Unexpected errors ['File "generics_variance.py", line 19, in <module>: argument "contravariant" to TypeVar not supported yet [not-supported-yet]']
2929
Line 27: Unexpected errors ['File "generics_variance.py", line 27, in __iter__: bad return type [bad-return-type]']

conformance/results/pytype/tuples_unpacked.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ File "tuples_unpacked.py", line 51, in func3: Invalid type annotation 'tuple[*tu
3434
conformance_automated = "Fail"
3535
errors_diff = """
3636
Line 59: Expected 1 errors
37-
Line 61: Expected 1 errors
37+
Lines 60, 61: Expected error (tag 't14')
3838
Line 13: Unexpected errors ['File "tuples_unpacked.py", line 13, in <module>: typing.Unpack not supported yet [not-supported-yet]', 'File "tuples_unpacked.py", line 13, in <module>: typing.TypeVarTuple not supported yet [not-supported-yet]']
3939
Line 16: Unexpected errors ['File "tuples_unpacked.py", line 16, in <module>: Invalid type annotation \\'<instance of tuple>\\' [invalid-annotation]']
4040
Line 17: Unexpected errors ['File "tuples_unpacked.py", line 17, in func1: Tuple[Any] [assert-type]']
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
version = "pytype 2024.04.11"
2-
test_duration = 34.2
2+
test_duration = 34.0

conformance/results/results.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,10 @@ <h3>Python Type System Conformance Test Results</h3>
165165
<div class='tc-time'>1.5sec</div>
166166
</th>
167167
<th class='tc-header'><div class='tc-name'>pyre 0.9.22</div>
168-
<div class='tc-time'>1.7sec</div>
168+
<div class='tc-time'>1.6sec</div>
169169
</th>
170170
<th class='tc-header'><div class='tc-name'>pytype 2024.04.11</div>
171-
<div class='tc-time'>34.2sec</div>
171+
<div class='tc-time'>34.0sec</div>
172172
</th>
173173
</tr>
174174
<tr><th class="column" colspan="5">

conformance/tests/generics_variance.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,14 @@ class CoContra_Child1(CoContra[T_co, T_contra]): # OK
122122
...
123123

124124

125-
class CoContra_Child2(
126-
CoContra[T_co, T_co] # E: Second type arg must be contravariant
125+
class CoContra_Child2( # E[CoContra_Child2]: Second type arg must be contravariant
126+
CoContra[T_co, T_co] # E[CoContra_Child2]: Second type arg must be contravariant
127127
):
128128
...
129129

130130

131-
class CoContra_Child3(
132-
CoContra[T_contra, T_contra] # E: First type arg must be covariant
131+
class CoContra_Child3( # E[CoContra_Child3]: First type arg must be covariant
132+
CoContra[T_contra, T_contra] # E[CoContra_Child3]: First type arg must be covariant
133133
):
134134
...
135135

@@ -138,8 +138,8 @@ class CoContra_Child4(CoContra[T, T]): # OK
138138
...
139139

140140

141-
class CoContra_Child5(
142-
CoContra[Co[T_co], Co[T_co]] # E: Second type arg must be contravariant
141+
class CoContra_Child5( # E[CoContra_Child5]: Second type arg must be contravariant
142+
CoContra[Co[T_co], Co[T_co]] # E[CoContra_Child5]: Second type arg must be contravariant
143143
):
144144
...
145145

@@ -192,7 +192,7 @@ class CoToContraToContra_WithTA(Contra_TA[Co_TA[Contra_TA[T_contra]]]): # E
192192
...
193193

194194

195-
class ContraToContraToContra_WithTA(
196-
Contra_TA[Contra_TA[Contra_TA[T_co]]] # E
195+
class ContraToContraToContra_WithTA( # E[ContraToContraToContra_WithTA]
196+
Contra_TA[Contra_TA[Contra_TA[T_co]]] # E[ContraToContraToContra_WithTA]
197197
):
198198
...

0 commit comments

Comments
 (0)