Skip to content

Modified generics_type_erasure.py test to not require an error when… #2008

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion conformance/results/mypy/generics_type_erasure.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ generics_type_erasure.py:45: error: Access to generic instance variables via cla
"""
conformance_automated = "Fail"
errors_diff = """
Line 46: Expected 1 errors
Line 19: Unexpected errors ['generics_type_erasure.py:19: error: Expression is of type "Node[Never]", not "Node[Any]" [assert-type]']
Line 22: Unexpected errors ['generics_type_erasure.py:22: error: Expression is of type "Never", not "Any" [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.15.0"
test_duration = 1.8
test_duration = 1.6
1 change: 0 additions & 1 deletion conformance/results/pyre/generics_type_erasure.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ Line 42: Expected 1 errors
Line 43: Expected 1 errors
Line 44: Expected 1 errors
Line 45: Expected 1 errors
Line 46: Expected 1 errors
Line 17: Unexpected errors ["generics_type_erasure.py:17:0 Assert type [70]: Expected `Node[str]` but got `Node[typing_extensions.Literal['']]`."]
Line 18: Unexpected errors ['generics_type_erasure.py:18:0 Assert type [70]: Expected `Node[int]` but got `Node[typing_extensions.Literal[0]]`.']
Line 19: Unexpected errors ['generics_type_erasure.py:19:0 Assert type [70]: Expected `Node[typing.Any]` but got `Node[Variable[T]]`.']
Expand Down
2 changes: 1 addition & 1 deletion conformance/results/pyre/version.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version = "pyre 0.9.23"
test_duration = 9.8
test_duration = 10.4
8 changes: 2 additions & 6 deletions conformance/results/pyright/generics_type_erasure.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
conformant = "Partial"
notes = """
Missing error regarding `type(instance).generic_attribute`.
"""
conformant = "Pass"
output = """
generics_type_erasure.py:38:16 - error: Argument of type "Literal['']" cannot be assigned to parameter "label" of type "int | None" in function "__init__"
  Type "Literal['']" is not assignable to type "int | None"
Expand All @@ -16,7 +13,6 @@ generics_type_erasure.py:43:11 - error: Access to generic instance variable thro
generics_type_erasure.py:44:6 - error: Access to generic instance variable through class is ambiguous (reportGeneralTypeIssues)
generics_type_erasure.py:45:6 - error: Access to generic instance variable through class is ambiguous (reportGeneralTypeIssues)
"""
conformance_automated = "Fail"
conformance_automated = "Pass"
errors_diff = """
Line 46: Expected 1 errors
"""
1 change: 0 additions & 1 deletion conformance/results/pytype/generics_type_erasure.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ Line 42: Expected 1 errors
Line 43: Expected 1 errors
Line 44: Expected 1 errors
Line 45: Expected 1 errors
Line 46: Expected 1 errors
"""
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.10.11"
test_duration = 33.6
test_duration = 36.2
10 changes: 5 additions & 5 deletions conformance/results/results.html
Original file line number Diff line number Diff line change
Expand Up @@ -159,16 +159,16 @@ <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.15.0</div>
<div class='tc-time'>1.8sec</div>
<div class='tc-time'>1.6sec</div>
</th>
<th class='tc-header'><div class='tc-name'>pyright 1.1.400</div>
<div class='tc-time'>1.1sec</div>
</th>
<th class='tc-header'><div class='tc-name'>pyre 0.9.23</div>
<div class='tc-time'>9.8sec</div>
<div class='tc-time'>10.4sec</div>
</th>
<th class='tc-header'><div class='tc-name'>pytype 2024.10.11</div>
<div class='tc-time'>33.6sec</div>
<div class='tc-time'>36.2sec</div>
</th>
</tr>
<tr><th class="column" colspan="5">
Expand Down Expand Up @@ -356,7 +356,7 @@ <h3>Python Type System Conformance Test Results</h3>
</tr>
<tr><th class="column col1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;generics_type_erasure</th>
<th class="column col2 partially-conformant"><div class="hover-text">Partial<span class="tooltip-text" id="bottom"><p>Infers Node[Never] instead of Node[Any] when argument is not provided.</p><p>False negative on instance attribute access on type(node).</p></span></div></th>
<th class="column col2 partially-conformant"><div class="hover-text">Partial<span class="tooltip-text" id="bottom"><p>no error for `type(n1).label`</p></span></div></th>
<th class="column col2 conformant">Pass</th>
<th class="column col2 partially-conformant"><div class="hover-text">Partial<span class="tooltip-text" id="bottom"><p>Does not erase unspecified type variables to `Any` prior to `assert_type` handling.</p><p>False negatives on instance attribute access on the type.</p><p>Does not infer type of `DefaultDict` with explicit type parameters on constructor.</p><p>False negatives on assert_type uses.</p></span></div></th>
<th class="column col2 not-conformant">Unsupported</th>
</tr>
Expand Down Expand Up @@ -491,7 +491,7 @@ <h3>Python Type System Conformance Test Results</h3>
</tr>
<tr><th class="column col1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;aliases_typealiastype</th>
<th class="column col2 partially-conformant"><div class="hover-text">Partial<span class="tooltip-text" id="bottom"><p>Incorrectly rejects some recursive type aliases using TypeAliasType.</p><p>Incorrectly rejects the use of a class-scoped TypeVar in a TypeAliasType definition.</p></span></div></th>
<th class="column col2 partially-conformant"><div class="hover-text">Partial<span class="tooltip-text" id="bottom"><p>incorrectly allows undefined self reference</p></span></div></th>
<th class="column col2 partially-conformant"><div class="hover-text">Partial<span class="tooltip-text" id="bottom"><p>Incorrectly allows undefined self reference.</p></span></div></th>
<th class="column col2 not-conformant"><div class="hover-text">Unsupported<span class="tooltip-text" id="bottom"><p>Support for TypeAliasType is not implemented.</p></span></div></th>
<th class="column col2 not-conformant"><div class="hover-text">Unsupported<span class="tooltip-text" id="bottom"><p>Support for TypeAliasType is not implemented.</p></span></div></th>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion conformance/tests/generics_type_erasure.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __init__(self, label: T | None = None) -> None:
Node[int].label # E
Node.label = 1 # E
Node.label # E
type(n1).label # E
type(n1).label # E?
assert_type(n1.label, int)
assert_type(Node[int]().label, int)
n1.label = 1 # OK
Expand Down