Skip to content
Open
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
29 changes: 29 additions & 0 deletions conformance/results/mypy/typeforms_typeform.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
conformant = "Partial"
notes = """
Does not support assigning Union and GenericAlias objects to their runtime types.
"""
conformance_automated = "Fail"
errors_diff = """
Line 46: Unexpected errors ['typeforms_typeform.py:46: error: Incompatible types in assignment (expression has type "UnionType | type[str]", variable has type "UnionType") [assignment]']
Line 49: Unexpected errors ['typeforms_typeform.py:49: 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:46: error: Incompatible types in assignment (expression has type "UnionType | type[str]", variable has type "UnionType") [assignment]
typeforms_typeform.py:49: error: Incompatible types in assignment (expression has type "type[list[int]]", variable has type "GenericAlias") [assignment]
typeforms_typeform.py:59: error: Argument 1 to "func1" has incompatible type "str"; expected "TypeForm[Any]" [arg-type]
typeforms_typeform.py:67: error: Incompatible types in assignment (expression has type "tuple[Never, ...]", variable has type "TypeForm[Any]") [assignment]
typeforms_typeform.py:68: error: Incompatible types in assignment (expression has type "tuple[int, int]", variable has type "TypeForm[Any]") [assignment]
typeforms_typeform.py:69: error: Incompatible types in assignment (expression has type "int", variable has type "TypeForm[Any]") [assignment]
typeforms_typeform.py:70: error: Incompatible types in assignment (expression has type "<typing special form>", variable has type "TypeForm[Any]") [assignment]
typeforms_typeform.py:71: error: Incompatible types in assignment (expression has type "<typing special form>", variable has type "TypeForm[Any]") [assignment]
typeforms_typeform.py:72: error: Incompatible types in assignment (expression has type "<typing special form>", variable has type "TypeForm[Any]") [assignment]
typeforms_typeform.py:73: error: Incompatible types in assignment (expression has type "<typing special form>", variable has type "TypeForm[Any]") [assignment]
typeforms_typeform.py:74: error: Incompatible types in assignment (expression has type "<typing special form>", variable has type "TypeForm[Any]") [assignment]
typeforms_typeform.py:75: error: Incompatible types in assignment (expression has type "str", variable has type "TypeForm[Any]") [assignment]
typeforms_typeform.py:86: error: Invalid type comment or annotation [valid-type]
typeforms_typeform.py:88: error: TypeForm argument is not a type [misc]
typeforms_typeform.py:98: error: Incompatible types in assignment (expression has type "TypeForm[int]", variable has type "TypeForm[str]") [assignment]
typeforms_typeform.py:108: error: Incompatible types in assignment (expression has type "type[int]", variable has type "TypeForm[str]") [assignment]
"""
78 changes: 78 additions & 0 deletions conformance/results/pyrefly/typeforms_typeform.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
conformant = "Unsupported"
conformance_automated = "Fail"
errors_diff = """
Line 59: Expected 1 errors
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 ['Expected a type form, got instance of `_SpecialForm` [not-a-type]']
Line 41: Unexpected errors ['Expected a type form, got instance of `object` [not-a-type]']
Line 46: Unexpected errors ['`type[str | None]` is not assignable to `UnionType` [bad-assignment]']
Line 47: Unexpected errors ['Expected a type form, got instance of `object` [not-a-type]']
Line 49: 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 50: Unexpected errors ['Expected a type form, got instance of `_SpecialForm` [not-a-type]']
Line 52: Unexpected errors ['Expected a type form, got instance of `object` [not-a-type]']
Line 53: Unexpected errors ['Expected a type form, got instance of `object` [not-a-type]']
Line 80: Unexpected errors ['Expected a callable, got `_SpecialForm` [not-callable]']
Line 81: Unexpected errors ['Expected a type form, got instance of `object` [not-a-type]']
Line 83: Unexpected errors ['Expected a callable, got `_SpecialForm` [not-callable]']
Line 84: Unexpected errors ['Expected a type form, got instance of `object` [not-a-type]']
Line 93: 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]']
Line 107: 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:14-22: Expected a type form, got instance of `_SpecialForm` [not-a-type]
ERROR typeforms_typeform.py:41:20-33: Expected a type form, got instance of `object` [not-a-type]
ERROR typeforms_typeform.py:46:30-40: `type[str | None]` is not assignable to `UnionType` [bad-assignment]
ERROR typeforms_typeform.py:47:15-35: Expected a type form, got instance of `object` [not-a-type]
ERROR typeforms_typeform.py:49:33-42: `type[list[int]]` is not assignable to `GenericAlias` [bad-assignment]
ERROR typeforms_typeform.py:49:33-42: Expected `v2_actual` to be a type alias, got `GenericAlias` [invalid-type-alias]
ERROR typeforms_typeform.py:50:15-23: Expected a type form, got instance of `_SpecialForm` [not-a-type]
ERROR typeforms_typeform.py:52:5-24: Expected a type form, got instance of `object` [not-a-type]
ERROR typeforms_typeform.py:53:5-23: Expected a type form, got instance of `object` [not-a-type]
ERROR typeforms_typeform.py:67:7-15: Expected a type form, got instance of `_SpecialForm` [not-a-type]
ERROR typeforms_typeform.py:68:7-15: Expected a type form, got instance of `_SpecialForm` [not-a-type]
ERROR typeforms_typeform.py:69:7-15: Expected a type form, got instance of `_SpecialForm` [not-a-type]
ERROR typeforms_typeform.py:70:7-15: Expected a type form, got instance of `_SpecialForm` [not-a-type]
ERROR typeforms_typeform.py:70:18-22: `Self` must appear within a class [invalid-annotation]
ERROR typeforms_typeform.py:71:7-15: Expected a type form, got instance of `_SpecialForm` [not-a-type]
ERROR typeforms_typeform.py:71:18-31: `ClassVar` is not allowed in this context [invalid-annotation]
ERROR typeforms_typeform.py:72:7-15: Expected a type form, got instance of `_SpecialForm` [not-a-type]
ERROR typeforms_typeform.py:72:18-28: `Final` is not allowed in this context [invalid-annotation]
ERROR typeforms_typeform.py:73:7-15: Expected a type form, got instance of `_SpecialForm` [not-a-type]
ERROR typeforms_typeform.py:74:7-15: Expected a type form, got instance of `_SpecialForm` [not-a-type]
ERROR typeforms_typeform.py:75:7-15: Expected a type form, got instance of `_SpecialForm` [not-a-type]
ERROR typeforms_typeform.py:80:6-14: Expected a callable, got `_SpecialForm` [not-callable]
ERROR typeforms_typeform.py:81:17-37: Expected a type form, got instance of `object` [not-a-type]
ERROR typeforms_typeform.py:83:6-14: Expected a callable, got `_SpecialForm` [not-callable]
ERROR typeforms_typeform.py:84:17-36: Expected a type form, got instance of `object` [not-a-type]
ERROR typeforms_typeform.py:86:6-14: Expected a callable, got `_SpecialForm` [not-callable]
ERROR typeforms_typeform.py:88:6-14: Expected a callable, got `_SpecialForm` [not-callable]
ERROR typeforms_typeform.py:93:24-37: 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]
ERROR typeforms_typeform.py:107:5-24: Expected a type form, got instance of `object` [not-a-type]
ERROR typeforms_typeform.py:108:5-18: Expected a type form, got instance of `object` [not-a-type]
"""
80 changes: 80 additions & 0 deletions conformance/results/pyright/typeforms_typeform.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
conformant = "Unsupported"
conformance_automated = "Fail"
errors_diff = """
Line 70: Expected 1 errors
Line 71: Expected 1 errors
Line 72: Expected 1 errors
Line 74: 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 47: Unexpected errors ['typeforms_typeform.py:47:38 - error: Type "UnionType" is not assignable to declared type "TypeForm[str | None]"']
Line 49: Unexpected errors ['typeforms_typeform.py:49:33 - error: Type "type[list[int]]" is not assignable to declared type "GenericAlias"']
Line 52: Unexpected errors ['typeforms_typeform.py:52:27 - error: Type "Annotated" is not assignable to declared type "TypeForm[int | str]"']
Line 53: Unexpected errors ['typeforms_typeform.py:53:26 - error: Type "Literal[\\'set[str]\\']" is not assignable to declared type "TypeForm[set[str]]"']
Line 58: Unexpected errors ['typeforms_typeform.py:58:7 - error: Argument of type "Literal[\\'int\\']" cannot be assigned to parameter "x" of type "TypeForm[Unknown]" in function "func1"']
Line 81: Unexpected errors ['typeforms_typeform.py:81:13 - error: "assert_type" mismatch: expected "TypeForm[str | None]" but received "UnionType" (reportAssertTypeFailure)']
Line 84: Unexpected errors ['typeforms_typeform.py:84: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:47: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:49: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:52: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:53: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:58:7 - error: Argument of type "Literal['int']" cannot be assigned to parameter "x" of type "TypeForm[Unknown]" in function "func1"
  "Literal['int']" is not assignable to "TypeForm[Unknown]" (reportArgumentType)
typeforms_typeform.py:59:7 - error: Argument of type "Literal['not a type']" cannot be assigned to parameter "x" of type "TypeForm[Unknown]" in function "func1"
  "Literal['not a type']" is not assignable to "TypeForm[Unknown]" (reportArgumentType)
typeforms_typeform.py:67:18 - error: Type "tuple[()]" is not assignable to declared type "TypeForm[Unknown]"
  "tuple[()]" is not assignable to "TypeForm[Unknown]" (reportAssignmentType)
typeforms_typeform.py:68: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:69: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:73:25 - error: Type variable "Ts" has no meaning in this context (reportGeneralTypeIssues)
typeforms_typeform.py:75:18 - 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:81:13 - error: "assert_type" mismatch: expected "TypeForm[str | None]" but received "UnionType" (reportAssertTypeFailure)
typeforms_typeform.py:84:13 - error: "assert_type" mismatch: expected "TypeForm[list[int]]" but received "type[list[int]]" (reportAssertTypeFailure)
typeforms_typeform.py:86:16 - error: type() call should not be used in type expression
  Use type[T] instead (reportInvalidTypeForm)
typeforms_typeform.py:86:16 - error: Call expression not allowed in type expression (reportInvalidTypeForm)
typeforms_typeform.py:88:15 - error: type() call should not be used in type expression
  Use type[T] instead (reportInvalidTypeForm)
typeforms_typeform.py:88:15 - error: Call expression not allowed in type expression (reportInvalidTypeForm)
typeforms_typeform.py:98: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:108:21 - error: Type "type[int]" is not assignable to declared type "TypeForm[str]"
  "int" is not assignable to "str" (reportAssignmentType)
"""
10 changes: 10 additions & 0 deletions conformance/results/results.html
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,16 @@ <h3>Python Type System Conformance Test Results</h3>
<th class="column col2 conformant">Pass</th>
</tr>
<tr><th class="column" colspan="6">
<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">Unsupported</th>
<th class="column col2 partially-conformant"><div class="hover-text">Partial<span class="tooltip-text" id="bottom"><p>TypeForm[Any] is not considered equivalent to itself.</p></span></div></th>
<th class="column col2 not-conformant">Unsupported</th>
<th class="column col2 not-conformant">Unsupported</th>
</tr>
<tr><th class="column" colspan="6">
<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