Skip to content

Commit 25d8dde

Browse files
committed
adjust for mypy
1 parent 1de742d commit 25d8dde

File tree

6 files changed

+21
-18
lines changed

6 files changed

+21
-18
lines changed

conformance/results/mypy/typeforms_typeform.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1+
conformant = "Partial"
2+
notes = """
3+
Does not support assigning Union and GenericAlias objects to their runtime types.
4+
"""
15
conformance_automated = "Fail"
26
errors_diff = """
3-
Line 34: Unexpected errors ['typeforms_typeform.py:34: error: Expression is of type "TypeForm[str]", not "TypeForm[Any]" [assert-type]']
47
Line 40: Unexpected errors ['typeforms_typeform.py:40: error: Incompatible types in assignment (expression has type "UnionType | type[str]", variable has type "UnionType") [assignment]']
58
Line 43: Unexpected errors ['typeforms_typeform.py:43: error: Incompatible types in assignment (expression has type "type[list[int]]", variable has type "GenericAlias") [assignment]']
69
"""
710
output = """
811
typeforms_typeform.py:23: error: Incompatible types in assignment (expression has type "TypeForm[str | int]", variable has type "TypeForm[str | None]") [assignment]
912
typeforms_typeform.py:24: error: Incompatible types in assignment (expression has type "TypeForm[list[str | None]]", variable has type "TypeForm[str | None]") [assignment]
10-
typeforms_typeform.py:34: error: Expression is of type "TypeForm[str]", not "TypeForm[Any]" [assert-type]
1113
typeforms_typeform.py:40: error: Incompatible types in assignment (expression has type "UnionType | type[str]", variable has type "UnionType") [assignment]
1214
typeforms_typeform.py:43: error: Incompatible types in assignment (expression has type "type[list[int]]", variable has type "GenericAlias") [assignment]
1315
typeforms_typeform.py:55: error: Incompatible types in assignment (expression has type "tuple[Never, ...]", variable has type "TypeForm[Any]") [assignment]

conformance/results/pyrefly/typeforms_typeform.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
conformance = "Unsupported"
12
conformance_automated = "Fail"
23
errors_diff = """
34
Line 15: Unexpected errors ['Expected a type form, got instance of `object` [not-a-type]']
@@ -9,8 +10,8 @@ Line 20: Unexpected errors ['Expected a type form, got instance of `object` [not
910
Line 21: Unexpected errors ['Expected a type form, got instance of `object` [not-a-type]']
1011
Line 29: Unexpected errors ['Expected a type form, got instance of `object` [not-a-type]']
1112
Line 30: Unexpected errors ['Expected a type form, got instance of `object` [not-a-type]']
12-
Line 34: Unexpected errors ['Expected a type form, got instance of `object` [not-a-type]']
13-
Line 35: Unexpected errors ['Expected a type form, got instance of `object` [not-a-type]']
13+
Line 31: Unexpected errors ['Expected a type form, got instance of `object` [not-a-type]']
14+
Line 32: Unexpected errors ['Expected a type form, got instance of `object` [not-a-type]']
1415
Line 40: Unexpected errors ['`type[str | None]` is not assignable to `UnionType` [bad-assignment]']
1516
Line 41: Unexpected errors ['Expected a type form, got instance of `object` [not-a-type]']
1617
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]']
@@ -37,8 +38,8 @@ ERROR typeforms_typeform.py:23:7-27: Expected a type form, got instance of `obje
3738
ERROR typeforms_typeform.py:24:7-27: Expected a type form, got instance of `object` [not-a-type]
3839
ERROR typeforms_typeform.py:29:8-21: Expected a type form, got instance of `object` [not-a-type]
3940
ERROR typeforms_typeform.py:30:8-21: Expected a type form, got instance of `object` [not-a-type]
40-
ERROR typeforms_typeform.py:34:20-33: Expected a type form, got instance of `object` [not-a-type]
41-
ERROR typeforms_typeform.py:35:20-33: Expected a type form, got instance of `object` [not-a-type]
41+
ERROR typeforms_typeform.py:31:20-33: Expected a type form, got instance of `object` [not-a-type]
42+
ERROR typeforms_typeform.py:32:20-33: Expected a type form, got instance of `object` [not-a-type]
4243
ERROR typeforms_typeform.py:40:30-40: `type[str | None]` is not assignable to `UnionType` [bad-assignment]
4344
ERROR typeforms_typeform.py:41:15-35: Expected a type form, got instance of `object` [not-a-type]
4445
ERROR typeforms_typeform.py:43:33-42: `type[list[int]]` is not assignable to `GenericAlias` [bad-assignment]

conformance/results/pyright/typeforms_typeform.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
conformance = "Unsupported"
12
conformance_automated = "Fail"
23
errors_diff = """
34
Line 58: Expected 1 errors
@@ -11,8 +12,7 @@ Line 19: Unexpected errors ['typeforms_typeform.py:19:29 - error: Type "UnionTyp
1112
Line 20: Unexpected errors ['typeforms_typeform.py:20:29 - error: Type "Literal[\\'str | None\\']" is not assignable to declared type "TypeForm[str | None]"']
1213
Line 21: Unexpected errors ['typeforms_typeform.py:21:29 - error: Type "type[Any]" is not assignable to declared type "TypeForm[str | None]"']
1314
Line 29: Unexpected errors ['typeforms_typeform.py:29:24 - error: Type "UnionType" is not assignable to declared type "TypeForm[Any]"']
14-
Line 34: Unexpected errors ['typeforms_typeform.py:34:13 - error: "assert_type" mismatch: expected "TypeForm[Any]" but received "type[str]" (reportAssertTypeFailure)']
15-
Line 35: Unexpected errors ['typeforms_typeform.py:35:13 - error: "assert_type" mismatch: expected "TypeForm[str]" but received "type[str]" (reportAssertTypeFailure)']
15+
Line 32: Unexpected errors ['typeforms_typeform.py:32:13 - error: "assert_type" mismatch: expected "TypeForm[str]" but received "type[str]" (reportAssertTypeFailure)']
1616
Line 41: Unexpected errors ['typeforms_typeform.py:41:38 - error: Type "UnionType" is not assignable to declared type "TypeForm[str | None]"']
1717
Line 43: Unexpected errors ['typeforms_typeform.py:43:33 - error: Type "type[list[int]]" is not assignable to declared type "GenericAlias"']
1818
Line 46: Unexpected errors ['typeforms_typeform.py:46:27 - error: Type "Annotated" is not assignable to declared type "TypeForm[int | str]"']
@@ -41,8 +41,7 @@ typeforms_typeform.py:24:30 - error: Type "type[list[str | None]]" is not assign
4141
    "list[str | None]" is not assignable to "None" (reportAssignmentType)
4242
typeforms_typeform.py:29:24 - error: Type "UnionType" is not assignable to declared type "TypeForm[Any]"
4343
  "UnionType" is not assignable to "TypeForm[Any]" (reportAssignmentType)
44-
typeforms_typeform.py:34:13 - error: "assert_type" mismatch: expected "TypeForm[Any]" but received "type[str]" (reportAssertTypeFailure)
45-
typeforms_typeform.py:35:13 - error: "assert_type" mismatch: expected "TypeForm[str]" but received "type[str]" (reportAssertTypeFailure)
44+
typeforms_typeform.py:32:13 - error: "assert_type" mismatch: expected "TypeForm[str]" but received "type[str]" (reportAssertTypeFailure)
4645
typeforms_typeform.py:41:38 - error: Type "UnionType" is not assignable to declared type "TypeForm[str | None]"
4746
  "UnionType" is not assignable to "TypeForm[str | None]" (reportAssignmentType)
4847
typeforms_typeform.py:43:33 - error: Type "type[list[int]]" is not assignable to declared type "GenericAlias"

conformance/results/results.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ <h3>Python Type System Conformance Test Results</h3>
218218
<a class="test_group" href="https://typing.readthedocs.io/en/latest/spec/type-forms.html">Type forms</a>
219219
</th></tr>
220220
<tr><th class="column col1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;typeforms_typeform</th>
221-
<th class="column col2 not-conformant">Unknown</th>
221+
<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>
222222
<th class="column col2 not-conformant">Unknown</th>
223223
<th class="column col2 not-conformant">Unknown</th>
224224
<th class="column col2 not-conformant">Unknown</th>

conformance/results/zuban/typeforms_typeform.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
conformance = "Unsupported"
12
conformance_automated = "Fail"
23
errors_diff = """
34
Line 15: Unexpected errors ['typeforms_typeform.py:15: error: Invalid type comment or annotation [valid-type]']
@@ -9,8 +10,8 @@ Line 20: Unexpected errors ['typeforms_typeform.py:20: error: Invalid type comme
910
Line 21: Unexpected errors ['typeforms_typeform.py:21: error: Invalid type comment or annotation [valid-type]']
1011
Line 29: Unexpected errors ['typeforms_typeform.py:29: error: Invalid type comment or annotation [valid-type]']
1112
Line 30: Unexpected errors ['typeforms_typeform.py:30: error: Invalid type comment or annotation [valid-type]']
12-
Line 34: Unexpected errors ['typeforms_typeform.py:34: error: Cast target is not a type [misc]']
13-
Line 35: Unexpected errors ['typeforms_typeform.py:35: error: Cast target is not a type [misc]']
13+
Line 31: Unexpected errors ['typeforms_typeform.py:31: error: Cast target is not a type [misc]']
14+
Line 32: Unexpected errors ['typeforms_typeform.py:32: error: Cast target is not a type [misc]']
1415
Line 41: Unexpected errors ['typeforms_typeform.py:41: error: Invalid type comment or annotation [valid-type]']
1516
Line 43: Unexpected errors ['typeforms_typeform.py:43: error: Incompatible types in assignment (expression has type "type[list[int]]", variable has type "GenericAlias") [assignment]']
1617
Line 44: Unexpected errors ['typeforms_typeform.py:44: error: Invalid type comment or annotation [valid-type]']
@@ -36,8 +37,8 @@ typeforms_typeform.py:23: error: Invalid type comment or annotation [valid-type
3637
typeforms_typeform.py:24: error: Invalid type comment or annotation [valid-type]
3738
typeforms_typeform.py:29: error: Invalid type comment or annotation [valid-type]
3839
typeforms_typeform.py:30: error: Invalid type comment or annotation [valid-type]
39-
typeforms_typeform.py:34: error: Cast target is not a type [misc]
40-
typeforms_typeform.py:35: error: Cast target is not a type [misc]
40+
typeforms_typeform.py:31: error: Cast target is not a type [misc]
41+
typeforms_typeform.py:32: error: Cast target is not a type [misc]
4142
typeforms_typeform.py:41: error: Invalid type comment or annotation [valid-type]
4243
typeforms_typeform.py:43: error: Incompatible types in assignment (expression has type "type[list[int]]", variable has type "GenericAlias") [assignment]
4344
typeforms_typeform.py:44: error: Invalid type comment or annotation [valid-type]

conformance/tests/typeforms_typeform.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@
2828

2929
v_any: TypeForm[Any] = int | str
3030
v_str: TypeForm[str] = str
31-
v_any = v_str # OK
32-
v_str = v_any # OK
33-
3431
assert_type(v_any, TypeForm[Any])
3532
assert_type(v_str, TypeForm[str])
3633

34+
v_any = v_str # OK
35+
v_str = v_any # OK
36+
3737

3838
# > Valid type expressions are assignable to ``TypeForm`` through implicit TypeForm evaluation.
3939

0 commit comments

Comments
 (0)