Skip to content

Commit

Permalink
remove __init__ parameter for ClassC in annotations_forward_refs
Browse files Browse the repository at this point in the history
  • Loading branch information
yangdanny97 committed Jul 16, 2024
1 parent 823d9e7 commit 13000cc
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 11 deletions.
3 changes: 0 additions & 3 deletions conformance/results/mypy/annotations_forward_refs.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ annotations_forward_refs.py:87: error: Function "annotations_forward_refs.ClassD
annotations_forward_refs.py:87: note: Perhaps you need "Callable[...]" or a callback protocol?
annotations_forward_refs.py:89: error: Function "annotations_forward_refs.ClassD.int" is not valid as a type [valid-type]
annotations_forward_refs.py:89: note: Perhaps you need "Callable[...]" or a callback protocol?
annotations_forward_refs.py:91: error: Variable "annotations_forward_refs.ClassD.ClassC" is not valid as a type [valid-type]
annotations_forward_refs.py:91: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
annotations_forward_refs.py:96: error: Expression is of type int?, not "int" [assert-type]
"""
conformance_automated = "Fail"
Expand All @@ -39,6 +37,5 @@ Line 24: Expected 1 errors
Line 25: Expected 1 errors
Line 66: Expected 1 errors
Line 87: Unexpected errors ['annotations_forward_refs.py:87: error: Function "annotations_forward_refs.ClassD.int" is not valid as a type [valid-type]']
Line 91: Unexpected errors ['annotations_forward_refs.py:91: error: Variable "annotations_forward_refs.ClassD.ClassC" is not valid as a type [valid-type]']
Line 96: Unexpected errors ['annotations_forward_refs.py:96: error: Expression is of type int?, not "int" [assert-type]']
"""
2 changes: 1 addition & 1 deletion conformance/results/mypy/version.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version = "mypy 1.10.1"
test_duration = 1.4
test_duration = 1.2
2 changes: 0 additions & 2 deletions conformance/results/pytype/annotations_forward_refs.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ File "annotations_forward_refs.py", line 80, in ClassD: Name 'ClassF' is not def
File "annotations_forward_refs.py", line 82, in ClassD: Invalid type annotation '<instance of str>' for str [invalid-annotation]
File "annotations_forward_refs.py", line 87, in ClassD: Invalid type annotation '<instance of Callable>' for x [invalid-annotation]
File "annotations_forward_refs.py", line 89, in ClassD: Invalid type annotation '<instance of Callable>' for y [invalid-annotation]
File "annotations_forward_refs.py", line 91, in ClassD: Invalid type annotation '<instance of ClassC>' for ClassC [invalid-annotation]
File "annotations_forward_refs.py", line 96, in <module>: Any [assert-type]
File "annotations_forward_refs.py", line 103, in <module>: unexpected indent [python-compiler-error]
"""
Expand All @@ -49,7 +48,6 @@ Line 55: Expected 1 errors
Line 40: Unexpected errors ['File "annotations_forward_refs.py", line 40, in <module>: invalid syntax [python-compiler-error]', 'File "annotations_forward_refs.py", line 40, in <module>: Invalid type annotation \\'{}\\' for p5 [invalid-annotation]', 'File "annotations_forward_refs.py", line 40, in <module>: Invalid type annotation \\'[int, str]\\' for p2 [invalid-annotation]', 'File "annotations_forward_refs.py", line 40, in <module>: Invalid type annotation \\'True\\' for p10 [invalid-annotation]', 'File "annotations_forward_refs.py", line 40, in <module>: Invalid type annotation \\'<instance of module>\\' for p15 [invalid-annotation]', 'File "annotations_forward_refs.py", line 40, in <module>: Invalid type annotation \\'<instance of List[Type[int]]>\\' for p4 [invalid-annotation]', 'File "annotations_forward_refs.py", line 40, in <module>: Invalid type annotation \\'1\\' for p9 [invalid-annotation]', 'File "annotations_forward_refs.py", line 40, in <module>: Invalid type annotation \\'1\\' for p11 [invalid-annotation]', 'File "annotations_forward_refs.py", line 40, in <module>: Invalid type annotation \\'-1\\' for p12 [invalid-annotation]', 'File "annotations_forward_refs.py", line 40, in <module>: Invalid type annotation \\'(int, str)\\' for p3 [invalid-annotation]']
Line 82: Unexpected errors ['File "annotations_forward_refs.py", line 82, in ClassD: Invalid type annotation \\'<instance of str>\\' for str [invalid-annotation]']
Line 87: Unexpected errors ['File "annotations_forward_refs.py", line 87, in ClassD: Invalid type annotation \\'<instance of Callable>\\' for x [invalid-annotation]']
Line 91: Unexpected errors ['File "annotations_forward_refs.py", line 91, in ClassD: Invalid type annotation \\'<instance of ClassC>\\' for ClassC [invalid-annotation]']
Line 96: Unexpected errors ['File "annotations_forward_refs.py", line 96, in <module>: Any [assert-type]']
Line 103: Unexpected errors ['File "annotations_forward_refs.py", line 103, in <module>: unexpected indent [python-compiler-error]']
"""
2 changes: 1 addition & 1 deletion conformance/results/pytype/version.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version = "pytype 2024.04.11"
test_duration = 37.0
test_duration = 34.2
4 changes: 2 additions & 2 deletions conformance/results/results.html
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ <h3>Python Type System Conformance Test Results</h3>
<div class="table_container"><table><tbody>
<tr><th class="col1">&nbsp;</th>
<th class='tc-header'><div class='tc-name'>mypy 1.10.1</div>
<div class='tc-time'>1.4sec</div>
<div class='tc-time'>1.2sec</div>
</th>
<th class='tc-header'><div class='tc-name'>pyright 1.1.371</div>
<div class='tc-time'>1.5sec</div>
Expand All @@ -168,7 +168,7 @@ <h3>Python Type System Conformance Test Results</h3>
<div class='tc-time'>1.7sec</div>
</th>
<th class='tc-header'><div class='tc-name'>pytype 2024.04.11</div>
<div class='tc-time'>37.0sec</div>
<div class='tc-time'>34.2sec</div>
</th>
</tr>
<tr><th class="column" colspan="5">
Expand Down
4 changes: 2 additions & 2 deletions conformance/tests/annotations_forward_refs.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ def int(self) -> None: # OK

y: int = 0 # E: Refers to local int, which isn't a legal type expression

def __init__(self, ClassC: "ClassC") -> None:
self.ClassC = ClassC
def __init__(self) -> None:
self.ClassC = ClassC()


assert_type(ClassD.str, str)
Expand Down

0 comments on commit 13000cc

Please sign in to comment.