Skip to content
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: 1 addition & 0 deletions conformance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ This project contains test cases for behaviors defined in the Python typing spec

* [concepts](https://typing.python.org/en/latest/spec/concepts.html)
* [annotations](https://typing.python.org/en/latest/spec/annotations.html)
* [typeforms](https://typing.python.org/en/latest/spec/type-forms.html)
* [specialtypes](https://typing.python.org/en/latest/spec/special-types.html)
* [generics](https://typing.python.org/en/latest/spec/generics.html)
* [qualifiers](https://typing.python.org/en/latest/spec/qualifiers.html)
Expand Down
30 changes: 30 additions & 0 deletions conformance/results/mypy/typeforms_typeform.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
conformant = "Partial"
notes = """
Does not support assigning Union and GenericAlias objects to their runtime types.
"""
conformance_automated = "Fail"
errors_diff = """
Line 40: Unexpected errors ['typeforms_typeform.py:40: error: Incompatible types in assignment (expression has type "UnionType | type[str]", variable has type "UnionType") [assignment]']
Line 43: Unexpected errors ['typeforms_typeform.py:43: error: Incompatible types in assignment (expression has type "type[list[int]]", variable has type "GenericAlias") [assignment]']
"""
output = """
typeforms_typeform.py:23: error: Incompatible types in assignment (expression has type "TypeForm[str | int]", variable has type "TypeForm[str | None]") [assignment]
typeforms_typeform.py:24: error: Incompatible types in assignment (expression has type "TypeForm[list[str | None]]", variable has type "TypeForm[str | None]") [assignment]
typeforms_typeform.py:40: error: Incompatible types in assignment (expression has type "UnionType | type[str]", variable has type "UnionType") [assignment]
typeforms_typeform.py:43: error: Incompatible types in assignment (expression has type "type[list[int]]", variable has type "GenericAlias") [assignment]
typeforms_typeform.py:55: error: Incompatible types in assignment (expression has type "tuple[Never, ...]", variable has type "TypeForm[Any]") [assignment]
typeforms_typeform.py:56: error: Incompatible types in assignment (expression has type "tuple[int, int]", variable has type "TypeForm[Any]") [assignment]
typeforms_typeform.py:57: error: Incompatible types in assignment (expression has type "int", variable has type "TypeForm[Any]") [assignment]
typeforms_typeform.py:58: error: Incompatible types in assignment (expression has type "<typing special form>", variable has type "TypeForm[Any]") [assignment]
typeforms_typeform.py:59: error: Incompatible types in assignment (expression has type "<typing special form>", variable has type "TypeForm[Any]") [assignment]
typeforms_typeform.py:60: error: Incompatible types in assignment (expression has type "<typing special form>", variable has type "TypeForm[Any]") [assignment]
typeforms_typeform.py:61: error: Incompatible types in assignment (expression has type "<typing special form>", variable has type "TypeForm[Any]") [assignment]
typeforms_typeform.py:62: error: Incompatible types in assignment (expression has type "<typing special form>", variable has type "TypeForm[Any]") [assignment]
typeforms_typeform.py:63: error: Incompatible types in assignment (expression has type "<typing special form>", variable has type "TypeForm[Any]") [assignment]
typeforms_typeform.py:64: error: Incompatible types in assignment (expression has type "<typing special form>", variable has type "TypeForm[Any]") [assignment]
typeforms_typeform.py:65: error: Incompatible types in assignment (expression has type "str", variable has type "TypeForm[Any]") [assignment]
typeforms_typeform.py:76: error: Invalid type comment or annotation [valid-type]
typeforms_typeform.py:78: error: TypeForm argument is not a type [misc]
typeforms_typeform.py:88: error: Incompatible types in assignment (expression has type "TypeForm[int]", variable has type "TypeForm[str]") [assignment]
typeforms_typeform.py:98: error: Incompatible types in assignment (expression has type "type[int]", variable has type "TypeForm[str]") [assignment]
"""
77 changes: 77 additions & 0 deletions conformance/results/pyrefly/typeforms_typeform.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
conformance = "Unsupported"
conformance_automated = "Fail"
errors_diff = """
Line 15: Unexpected errors ['Expected a type form, got instance of `object` [not-a-type]']
Line 16: Unexpected errors ['Expected a type form, got instance of `object` [not-a-type]']
Line 17: Unexpected errors ['Expected a type form, got instance of `object` [not-a-type]']
Line 18: Unexpected errors ['Expected a type form, got instance of `object` [not-a-type]']
Line 19: Unexpected errors ['Expected a type form, got instance of `object` [not-a-type]']
Line 20: Unexpected errors ['Expected a type form, got instance of `object` [not-a-type]']
Line 21: Unexpected errors ['Expected a type form, got instance of `object` [not-a-type]']
Line 29: Unexpected errors ['Expected a type form, got instance of `object` [not-a-type]']
Line 30: Unexpected errors ['Expected a type form, got instance of `object` [not-a-type]']
Line 31: Unexpected errors ['Expected a type form, got instance of `object` [not-a-type]']
Line 32: Unexpected errors ['Expected a type form, got instance of `object` [not-a-type]']
Line 40: Unexpected errors ['`type[str | None]` is not assignable to `UnionType` [bad-assignment]']
Line 41: Unexpected errors ['Expected a type form, got instance of `object` [not-a-type]']
Line 43: Unexpected errors ['`type[list[int]]` is not assignable to `GenericAlias` [bad-assignment]', 'Expected `v2_actual` to be a type alias, got `GenericAlias` [invalid-type-alias]']
Line 44: Unexpected errors ['Expected a type form, got instance of `_SpecialForm` [not-a-type]']
Line 46: Unexpected errors ['Expected a type form, got instance of `object` [not-a-type]']
Line 47: Unexpected errors ['Expected a type form, got instance of `object` [not-a-type]']
Line 70: Unexpected errors ['Expected a callable, got `_SpecialForm` [not-callable]']
Line 71: Unexpected errors ['Expected a type form, got instance of `object` [not-a-type]']
Line 73: Unexpected errors ['Expected a callable, got `_SpecialForm` [not-callable]']
Line 74: Unexpected errors ['Expected a type form, got instance of `object` [not-a-type]']
Line 83: Unexpected errors ['Expected a type form, got instance of `object` [not-a-type]']
Line 87: Unexpected errors ['Expected a type form, got instance of `object` [not-a-type]']
Line 97: Unexpected errors ['Expected a type form, got instance of `object` [not-a-type]']
"""
output = """
ERROR typeforms_typeform.py:15:6-26: Expected a type form, got instance of `object` [not-a-type]
ERROR typeforms_typeform.py:16:6-26: Expected a type form, got instance of `object` [not-a-type]
ERROR typeforms_typeform.py:17:6-26: Expected a type form, got instance of `object` [not-a-type]
ERROR typeforms_typeform.py:18:6-26: Expected a type form, got instance of `object` [not-a-type]
ERROR typeforms_typeform.py:19:6-26: Expected a type form, got instance of `object` [not-a-type]
ERROR typeforms_typeform.py:20:6-26: Expected a type form, got instance of `object` [not-a-type]
ERROR typeforms_typeform.py:21:6-26: Expected a type form, got instance of `object` [not-a-type]
ERROR typeforms_typeform.py:23:7-27: Expected a type form, got instance of `object` [not-a-type]
ERROR typeforms_typeform.py:24:7-27: Expected a type form, got instance of `object` [not-a-type]
ERROR typeforms_typeform.py:29:8-21: Expected a type form, got instance of `object` [not-a-type]
ERROR typeforms_typeform.py:30:8-21: Expected a type form, got instance of `object` [not-a-type]
ERROR typeforms_typeform.py:31:20-33: Expected a type form, got instance of `object` [not-a-type]
ERROR typeforms_typeform.py:32:20-33: Expected a type form, got instance of `object` [not-a-type]
ERROR typeforms_typeform.py:40:30-40: `type[str | None]` is not assignable to `UnionType` [bad-assignment]
ERROR typeforms_typeform.py:41:15-35: Expected a type form, got instance of `object` [not-a-type]
ERROR typeforms_typeform.py:43:33-42: `type[list[int]]` is not assignable to `GenericAlias` [bad-assignment]
ERROR typeforms_typeform.py:43:33-42: Expected `v2_actual` to be a type alias, got `GenericAlias` [invalid-type-alias]
ERROR typeforms_typeform.py:44:15-23: Expected a type form, got instance of `_SpecialForm` [not-a-type]
ERROR typeforms_typeform.py:46:5-24: Expected a type form, got instance of `object` [not-a-type]
ERROR typeforms_typeform.py:47:5-23: Expected a type form, got instance of `object` [not-a-type]
ERROR typeforms_typeform.py:55:7-15: Expected a type form, got instance of `_SpecialForm` [not-a-type]
ERROR typeforms_typeform.py:56:7-15: Expected a type form, got instance of `_SpecialForm` [not-a-type]
ERROR typeforms_typeform.py:57:7-15: Expected a type form, got instance of `_SpecialForm` [not-a-type]
ERROR typeforms_typeform.py:58:7-15: Expected a type form, got instance of `_SpecialForm` [not-a-type]
ERROR typeforms_typeform.py:58:18-22: `Self` must appear within a class [invalid-annotation]
ERROR typeforms_typeform.py:59:7-15: Expected a type form, got instance of `_SpecialForm` [not-a-type]
ERROR typeforms_typeform.py:59:26-29: Expected a type form, got instance of `Literal[1]` [not-a-type]
ERROR typeforms_typeform.py:60:7-15: Expected a type form, got instance of `_SpecialForm` [not-a-type]
ERROR typeforms_typeform.py:60:26-29: Invalid literal expression [invalid-literal]
ERROR typeforms_typeform.py:61:7-15: Expected a type form, got instance of `_SpecialForm` [not-a-type]
ERROR typeforms_typeform.py:61:18-31: `ClassVar` is not allowed in this context [invalid-annotation]
ERROR typeforms_typeform.py:62:7-15: Expected a type form, got instance of `_SpecialForm` [not-a-type]
ERROR typeforms_typeform.py:62:18-28: `Final` is not allowed in this context [invalid-annotation]
ERROR typeforms_typeform.py:63:7-15: Expected a type form, got instance of `_SpecialForm` [not-a-type]
ERROR typeforms_typeform.py:64:8-16: Expected a type form, got instance of `_SpecialForm` [not-a-type]
ERROR typeforms_typeform.py:65:8-16: Expected a type form, got instance of `_SpecialForm` [not-a-type]
ERROR typeforms_typeform.py:70:6-14: Expected a callable, got `_SpecialForm` [not-callable]
ERROR typeforms_typeform.py:71:17-37: Expected a type form, got instance of `object` [not-a-type]
ERROR typeforms_typeform.py:73:6-14: Expected a callable, got `_SpecialForm` [not-callable]
ERROR typeforms_typeform.py:74:17-36: Expected a type form, got instance of `object` [not-a-type]
ERROR typeforms_typeform.py:76:6-14: Expected a callable, got `_SpecialForm` [not-callable]
ERROR typeforms_typeform.py:78:6-14: Expected a callable, got `_SpecialForm` [not-callable]
ERROR typeforms_typeform.py:83:24-37: Expected a type form, got instance of `object` [not-a-type]
ERROR typeforms_typeform.py:87:5-24: Expected a type form, got instance of `object` [not-a-type]
ERROR typeforms_typeform.py:88:5-18: Expected a type form, got instance of `object` [not-a-type]
ERROR typeforms_typeform.py:97:5-24: Expected a type form, got instance of `object` [not-a-type]
ERROR typeforms_typeform.py:98:5-18: Expected a type form, got instance of `object` [not-a-type]
"""
78 changes: 78 additions & 0 deletions conformance/results/pyright/typeforms_typeform.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
conformance = "Unsupported"
conformance_automated = "Fail"
errors_diff = """
Line 58: Expected 1 errors
Line 60: Expected 1 errors
Line 61: Expected 1 errors
Line 62: Expected 1 errors
Line 64: Expected 1 errors
Line 15: Unexpected errors ['typeforms_typeform.py:15:29 - error: Type "UnionType" is not assignable to declared type "TypeForm[str | None]"']
Line 17: Unexpected errors ['typeforms_typeform.py:17:29 - error: Type "None" is not assignable to declared type "TypeForm[str | None]"']
Line 19: Unexpected errors ['typeforms_typeform.py:19:29 - error: Type "UnionType" is not assignable to declared type "TypeForm[str | None]"']
Line 20: Unexpected errors ['typeforms_typeform.py:20:29 - error: Type "Literal[\\'str | None\\']" is not assignable to declared type "TypeForm[str | None]"']
Line 21: Unexpected errors ['typeforms_typeform.py:21:29 - error: Type "type[Any]" is not assignable to declared type "TypeForm[str | None]"']
Line 29: Unexpected errors ['typeforms_typeform.py:29:24 - error: Type "UnionType" is not assignable to declared type "TypeForm[Any]"']
Line 32: Unexpected errors ['typeforms_typeform.py:32:13 - error: "assert_type" mismatch: expected "TypeForm[str]" but received "type[str]" (reportAssertTypeFailure)']
Line 41: Unexpected errors ['typeforms_typeform.py:41:38 - error: Type "UnionType" is not assignable to declared type "TypeForm[str | None]"']
Line 43: Unexpected errors ['typeforms_typeform.py:43:33 - error: Type "type[list[int]]" is not assignable to declared type "GenericAlias"']
Line 46: Unexpected errors ['typeforms_typeform.py:46:27 - error: Type "Annotated" is not assignable to declared type "TypeForm[int | str]"']
Line 47: Unexpected errors ['typeforms_typeform.py:47:26 - error: Type "Literal[\\'set[str]\\']" is not assignable to declared type "TypeForm[set[str]]"']
Line 71: Unexpected errors ['typeforms_typeform.py:71:13 - error: "assert_type" mismatch: expected "TypeForm[str | None]" but received "UnionType" (reportAssertTypeFailure)']
Line 74: Unexpected errors ['typeforms_typeform.py:74:13 - error: "assert_type" mismatch: expected "TypeForm[list[int]]" but received "type[list[int]]" (reportAssertTypeFailure)']
"""
output = """
typeforms_typeform.py:15:29 - error: Type "UnionType" is not assignable to declared type "TypeForm[str | None]"
  "UnionType" is not assignable to "TypeForm[str | None]" (reportAssignmentType)
typeforms_typeform.py:17:29 - error: Type "None" is not assignable to declared type "TypeForm[str | None]"
  "None" is not assignable to "TypeForm[str | None]" (reportAssignmentType)
typeforms_typeform.py:19:29 - error: Type "UnionType" is not assignable to declared type "TypeForm[str | None]"
  "UnionType" is not assignable to "TypeForm[str | None]" (reportAssignmentType)
typeforms_typeform.py:20:29 - error: Type "Literal['str | None']" is not assignable to declared type "TypeForm[str | None]"
  "Literal['str | None']" is not assignable to "TypeForm[str | None]" (reportAssignmentType)
typeforms_typeform.py:21:29 - error: Type "type[Any]" is not assignable to declared type "TypeForm[str | None]"
  Type "Any" is not assignable to type "str | None"
    "Any" is not assignable to "str"
    "Any" is not assignable to "None" (reportAssignmentType)
typeforms_typeform.py:23:30 - error: Type "UnionType" is not assignable to declared type "TypeForm[str | None]"
  "UnionType" is not assignable to "TypeForm[str | None]" (reportAssignmentType)
typeforms_typeform.py:24:30 - error: Type "type[list[str | None]]" is not assignable to declared type "TypeForm[str | None]"
  Type "list[str | None]" is not assignable to type "str | None"
    "list[str | None]" is not assignable to "str"
    "list[str | None]" is not assignable to "None" (reportAssignmentType)
typeforms_typeform.py:29:24 - error: Type "UnionType" is not assignable to declared type "TypeForm[Any]"
  "UnionType" is not assignable to "TypeForm[Any]" (reportAssignmentType)
typeforms_typeform.py:32:13 - error: "assert_type" mismatch: expected "TypeForm[str]" but received "type[str]" (reportAssertTypeFailure)
typeforms_typeform.py:41:38 - error: Type "UnionType" is not assignable to declared type "TypeForm[str | None]"
  "UnionType" is not assignable to "TypeForm[str | None]" (reportAssignmentType)
typeforms_typeform.py:43:33 - error: Type "type[list[int]]" is not assignable to declared type "GenericAlias"
  Type "type[list[int]]" is not assignable to type "GenericAlias" (reportAssignmentType)
typeforms_typeform.py:46:27 - error: Type "Annotated" is not assignable to declared type "TypeForm[int | str]"
  "Annotated" is not assignable to "TypeForm[int | str]" (reportAssignmentType)
typeforms_typeform.py:47:26 - error: Type "Literal['set[str]']" is not assignable to declared type "TypeForm[set[str]]"
  "Literal['set[str]']" is not assignable to "TypeForm[set[str]]" (reportAssignmentType)
typeforms_typeform.py:55:18 - error: Type "tuple[()]" is not assignable to declared type "TypeForm[Unknown]"
  "tuple[()]" is not assignable to "TypeForm[Unknown]" (reportAssignmentType)
typeforms_typeform.py:56:18 - error: Type "tuple[Literal[1], Literal[2]]" is not assignable to declared type "TypeForm[Unknown]"
  "tuple[Literal[1], Literal[2]]" is not assignable to "TypeForm[Unknown]" (reportAssignmentType)
typeforms_typeform.py:57:18 - error: Type "Literal[1]" is not assignable to declared type "TypeForm[Unknown]"
  "Literal[1]" is not assignable to "TypeForm[Unknown]" (reportAssignmentType)
typeforms_typeform.py:59:18 - error: Type "Literal" is not assignable to declared type "TypeForm[Unknown]"
  "Literal" is not assignable to "TypeForm[Unknown]" (reportAssignmentType)
typeforms_typeform.py:63:25 - error: Type variable "Ts" has no meaning in this context (reportGeneralTypeIssues)
typeforms_typeform.py:65:19 - error: Type "Literal['int + str']" is not assignable to declared type "TypeForm[Unknown]"
  "Literal['int + str']" is not assignable to "TypeForm[Unknown]" (reportAssignmentType)
typeforms_typeform.py:71:13 - error: "assert_type" mismatch: expected "TypeForm[str | None]" but received "UnionType" (reportAssertTypeFailure)
typeforms_typeform.py:74:13 - error: "assert_type" mismatch: expected "TypeForm[list[int]]" but received "type[list[int]]" (reportAssertTypeFailure)
typeforms_typeform.py:76:16 - error: type() call should not be used in type expression
  Use type[T] instead (reportInvalidTypeForm)
typeforms_typeform.py:76:16 - error: Call expression not allowed in type expression (reportInvalidTypeForm)
typeforms_typeform.py:78:15 - error: type() call should not be used in type expression
  Use type[T] instead (reportInvalidTypeForm)
typeforms_typeform.py:78:15 - error: Call expression not allowed in type expression (reportInvalidTypeForm)
typeforms_typeform.py:88:21 - error: Type "TypeForm[int]" is not assignable to declared type "TypeForm[str]"
  "TypeForm[int]" is not assignable to "TypeForm[str]"
    Type parameter "T@TypeForm" is covariant, but "int" is not a subtype of "str"
      "int" is not assignable to "str" (reportAssignmentType)
typeforms_typeform.py:98:21 - error: Type "type[int]" is not assignable to declared type "TypeForm[str]"
  "int" is not assignable to "str" (reportAssignmentType)
"""
11 changes: 10 additions & 1 deletion conformance/results/results.html
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ <h3>Python Type System Conformance Test Results</h3>
</th>
<th class='tc-header'><div class='tc-name'>pyright 1.1.408</div>
</th>
<th class='tc-header'><div class='tc-name'>zuban 0.5.1</div>
<th class='tc-header'><div class='tc-name'>zuban 0.6.0</div>
</th>
<th class='tc-header'><div class='tc-name'>pyrefly 0.53.0</div>
</th>
Expand Down Expand Up @@ -215,6 +215,15 @@ <h3>Python Type System Conformance Test Results</h3>
<th class="column col2 conformant">Pass</th>
</tr>
<tr><th class="column" colspan="5">
<a class="test_group" href="https://typing.readthedocs.io/en/latest/spec/type-forms.html">Type forms</a>
</th></tr>
<tr><th class="column col1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;typeforms_typeform</th>
<th class="column col2 partially-conformant"><div class="hover-text">Partial<span class="tooltip-text" id="bottom"><p>Does not support assigning Union and GenericAlias objects to their runtime types.</p></span></div></th>
<th class="column col2 not-conformant">Unknown</th>
<th class="column col2 not-conformant">Unknown</th>
<th class="column col2 not-conformant">Unknown</th>
</tr>
<tr><th class="column" colspan="5">
<a class="test_group" href="https://typing.readthedocs.io/en/latest/spec/special-types.html">Special types in annotations</a>
</th></tr>
<tr><th class="column col1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;specialtypes_any</th>
Expand Down
Loading