Skip to content

Commit d08c053

Browse files
authored
Avoid asserting debatable super() behavior in an unrelated test (#2253)
1 parent 7bf2409 commit d08c053

File tree

4 files changed

+5
-10
lines changed

4 files changed

+5
-10
lines changed

conformance/results/mypy/constructors_call_metaclass.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@ conformance_automated = "Fail"
77
errors_diff = """
88
Line 26: Unexpected errors ['constructors_call_metaclass.py:26: error: Expression is of type "Class1", not "Never" [assert-type]', 'constructors_call_metaclass.py:26: error: Missing positional argument "x" in call to "Class1" [call-arg]']
99
Line 39: Unexpected errors ['constructors_call_metaclass.py:39: error: Expression is of type "Class2", not "int | Meta2" [assert-type]', 'constructors_call_metaclass.py:39: error: Missing positional argument "x" in call to "Class2" [call-arg]']
10-
Line 46: Unexpected errors ['constructors_call_metaclass.py:46: error: Argument 2 for "super" not an instance of argument 1 [misc]']
1110
"""
1211
output = """
1312
constructors_call_metaclass.py:26: error: Expression is of type "Class1", not "Never" [assert-type]
1413
constructors_call_metaclass.py:26: error: Missing positional argument "x" in call to "Class1" [call-arg]
1514
constructors_call_metaclass.py:39: error: Expression is of type "Class2", not "int | Meta2" [assert-type]
1615
constructors_call_metaclass.py:39: error: Missing positional argument "x" in call to "Class2" [call-arg]
17-
constructors_call_metaclass.py:46: error: Argument 2 for "super" not an instance of argument 1 [misc]
1816
constructors_call_metaclass.py:54: error: Missing positional argument "x" in call to "Class3" [call-arg]
1917
constructors_call_metaclass.py:68: error: Missing positional argument "x" in call to "Class4" [call-arg]
2018
"""

conformance/results/results.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ <h3>Python Type System Conformance Test Results</h3>
732732
<th class="column col2 conformant">Pass</th>
733733
<th class="column col2 conformant">Pass</th>
734734
<th class="column col2 conformant">Pass</th>
735-
<th class="column col2 partially-conformant"><div class="hover-text">Partial<span class="tooltip-text" id="bottom"><p>Emits a diagnostic if `super().__call__()` is called in an overridden `__call__` method on a subclass of `type` and the first argument of the overridden `__call__` method is annotated with `type[T]` where `T` is a type variable with no upper bound.</p></span></div></th>
735+
<th class="column col2 conformant">Pass</th>
736736
</tr>
737737
<tr><th class="column col1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;constructors_call_new</th>
738738
<th class="column col2 partially-conformant"><div class="hover-text">Partial<span class="tooltip-text" id="bottom"><p>Does not support __new__ return type that is not a subclass of the class being constructed.</p><p>Does not skip evaluation of __init__ based on __new__ return type.</p><p>Does not report errors during binding to cls parameter of __new__ method.</p></span></div></th>
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
conformance_automated = "Fail"
2-
conformant = "Partial"
1+
conformance_automated = "Pass"
2+
conformant = "Pass"
33
notes = """
4-
Emits a diagnostic if `super().__call__()` is called in an overridden `__call__` method on a subclass of `type` and the first argument of the overridden `__call__` method is annotated with `type[T]` where `T` is a type variable with no upper bound.
54
"""
65
errors_diff = """
7-
Line 46: Unexpected errors ["constructors_call_metaclass.py:46:16: error[invalid-super-argument] `type[T@__call__]` is not an instance or subclass of `<class 'Meta3'>` in `super(<class 'Meta3'>, type[T@__call__])` call"]
86
"""
97
output = """
10-
constructors_call_metaclass.py:46:16: error[invalid-super-argument] `type[T@__call__]` is not an instance or subclass of `<class 'Meta3'>` in `super(<class 'Meta3'>, type[T@__call__])` call
118
constructors_call_metaclass.py:54:1: error[missing-argument] No argument provided for required parameter `x` of function `__new__`
129
constructors_call_metaclass.py:68:1: error[missing-argument] No argument provided for required parameter `x` of function `__new__`
1310
"""

conformance/tests/constructors_call_metaclass.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def __new__(cls, x: int) -> Self:
4343

4444
class Meta3(type):
4545
def __call__(cls: type[T], *args, **kwargs) -> T:
46-
return super().__call__(*args, **kwargs)
46+
return type.__call__(cls, *args, **kwargs)
4747

4848

4949
class Class3(metaclass=Meta3):
@@ -57,7 +57,7 @@ def __new__(cls, x: int) -> Self:
5757

5858
class Meta4(type):
5959
def __call__(cls, *args, **kwargs):
60-
return super().__call__(*args, **kwargs)
60+
return type.__call__(cls, *args, **kwargs)
6161

6262

6363
class Class4(metaclass=Meta4):

0 commit comments

Comments
 (0)