Skip to content

Commit 2d2041b

Browse files
committed
Specify that assert_type() uses equivalence
1 parent ef75648 commit 2d2041b

13 files changed

+57
-44
lines changed

conformance/results/mypy/directives_assert_type.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
conformant = "Pass"
22
output = """
3-
directives_assert_type.py:27: error: Expression is of type "int | str", not "int" [assert-type]
4-
directives_assert_type.py:28: error: Expression is of type "Any", not "int" [assert-type]
5-
directives_assert_type.py:29: error: Expression is of type "Literal[4]", not "int" [assert-type]
6-
directives_assert_type.py:31: error: "assert_type" expects 2 arguments [misc]
7-
directives_assert_type.py:31: error: Too few arguments for "assert_type" [call-arg]
8-
directives_assert_type.py:32: error: Expression is of type "Literal['']", not "int" [assert-type]
9-
directives_assert_type.py:33: error: "assert_type" expects 2 arguments [misc]
10-
directives_assert_type.py:33: error: Too many arguments for "assert_type" [call-arg]
3+
directives_assert_type.py:28: error: Expression is of type "int | str", not "int" [assert-type]
4+
directives_assert_type.py:29: error: Expression is of type "Any", not "int" [assert-type]
5+
directives_assert_type.py:30: error: Expression is of type "Literal[4]", not "int" [assert-type]
6+
directives_assert_type.py:32: error: "assert_type" expects 2 arguments [misc]
7+
directives_assert_type.py:32: error: Too few arguments for "assert_type" [call-arg]
8+
directives_assert_type.py:33: error: Expression is of type "Literal['']", not "int" [assert-type]
9+
directives_assert_type.py:34: error: "assert_type" expects 2 arguments [misc]
10+
directives_assert_type.py:34: error: Too many arguments for "assert_type" [call-arg]
1111
"""
1212
conformance_automated = "Pass"
1313
errors_diff = """

conformance/results/mypy/version.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
version = "mypy 1.15.0"
2-
test_duration = 1.5
2+
test_duration = 2.2

conformance/results/pyre/directives_assert_type.toml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ conformant = "Pass"
22
notes = """
33
"""
44
output = """
5-
directives_assert_type.py:27:4 Assert type [70]: Expected `int` but got `Union[int, str]`.
6-
directives_assert_type.py:28:4 Assert type [70]: Expected `int` but got `typing.Any`.
7-
directives_assert_type.py:29:4 Assert type [70]: Expected `int` but got `typing_extensions.Literal[4]`.
8-
directives_assert_type.py:31:4 Missing argument [20]: Call `assert_type` expects argument in position 0.
9-
directives_assert_type.py:32:4 Assert type [70]: Expected `int` but got `typing_extensions.Literal['']`.
10-
directives_assert_type.py:33:4 Too many arguments [19]: Call `assert_type` expects 2 positional arguments, 3 were provided.
5+
directives_assert_type.py:22:4 Assert type [70]: Expected `Union[bool, int, str]` but got `Union[int, str]`.
6+
directives_assert_type.py:28:4 Assert type [70]: Expected `int` but got `Union[int, str]`.
7+
directives_assert_type.py:29:4 Assert type [70]: Expected `int` but got `typing.Any`.
8+
directives_assert_type.py:30:4 Assert type [70]: Expected `int` but got `typing_extensions.Literal[4]`.
9+
directives_assert_type.py:32:4 Missing argument [20]: Call `assert_type` expects argument in position 0.
10+
directives_assert_type.py:33:4 Assert type [70]: Expected `int` but got `typing_extensions.Literal['']`.
11+
directives_assert_type.py:34:4 Too many arguments [19]: Call `assert_type` expects 2 positional arguments, 3 were provided.
1112
"""
12-
conformance_automated = "Pass"
13+
conformance_automated = "Fail"
1314
errors_diff = """
15+
Line 22: Unexpected errors ['directives_assert_type.py:22:4 Assert type [70]: Expected `Union[bool, int, str]` but got `Union[int, str]`.']
1416
"""

conformance/results/pyre/version.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
version = "pyre 0.9.23"
2-
test_duration = 10.7
2+
test_duration = 9.9

conformance/results/pyright/aliases_typealiastype.toml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
conformant = "Partial"
2-
notes = """
3-
Incorrectly allows undefined self reference.
4-
"""
1+
conformant = "Pass"
52
output = """
63
aliases_typealiastype.py:32:18 - error: Cannot access attribute "other_attrib" for class "TypeAliasType"
74
  Attribute "other_attrib" is unknown (reportAttributeAccessIssue)
@@ -31,8 +28,8 @@ aliases_typealiastype.py:61:42 - error: Expected class but received "Literal[Tru
3128
aliases_typealiastype.py:62:42 - error: Expected class but received "Literal[1]" (reportGeneralTypeIssues)
3229
aliases_typealiastype.py:63:42 - error: Binary operator not allowed in type expression (reportInvalidTypeForm)
3330
aliases_typealiastype.py:64:42 - error: Type expressions cannot use format string literals (f-strings) (reportGeneralTypeIssues)
31+
aliases_typealiastype.py:66:47 - error: "BadAlias21" is not defined (reportUndefinedVariable)
3432
"""
35-
conformance_automated = "Fail"
33+
conformance_automated = "Pass"
3634
errors_diff = """
37-
Line 66: Expected 1 errors
3835
"""

conformance/results/pyright/callables_protocol.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,10 @@ callables_protocol.py:70:7 - error: Type "(**b: str) -> None" is not assignable
3232
  Type "(**b: str) -> None" is not assignable to type "(*vals: bytes, **kwargs: str) -> None"
3333
    Parameter "*vals" has no corresponding parameter (reportAssignmentType)
3434
callables_protocol.py:97:16 - error: Type "(x: int) -> None" is not assignable to declared type "Proto4"
35-
  "function" is incompatible with protocol "Proto4"
36-
    "other_attribute" is not present
37-
    "__call__" is not present (reportAssignmentType)
35+
  "FunctionType" is incompatible with protocol "Proto4"
36+
    "other_attribute" is not present (reportAssignmentType)
3837
callables_protocol.py:121:18 - error: Type "(*vals: bytes, max_len: int | None = None) -> list[bytes]" is not assignable to declared type "NotProto6"
39-
  "function" is not assignable to "NotProto6" (reportAssignmentType)
38+
  "FunctionType" is not assignable to "NotProto6" (reportAssignmentType)
4039
callables_protocol.py:169:7 - error: Type "(x: int) -> Any" is not assignable to declared type "Proto8"
4140
  One or more overloads of "__call__" is not assignable
4241
    Type "(x: int) -> Any" is not assignable to type "(x: str) -> str"
Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
conformant = "Pass"
1+
conformant = "Fail"
2+
notes = """
3+
Fails to treat equivalent unions as equivalent.
4+
"""
25
output = """
3-
directives_assert_type.py:27:17 - error: "assert_type" mismatch: expected "int" but received "int | str" (reportAssertTypeFailure)
4-
directives_assert_type.py:28:17 - error: "assert_type" mismatch: expected "int" but received "Any" (reportAssertTypeFailure)
5-
directives_assert_type.py:29:17 - error: "assert_type" mismatch: expected "int" but received "Literal[4]" (reportAssertTypeFailure)
6-
directives_assert_type.py:31:5 - error: "assert_type" expects two positional arguments (reportCallIssue)
7-
directives_assert_type.py:32:17 - error: "assert_type" mismatch: expected "int" but received "Literal['']" (reportAssertTypeFailure)
8-
directives_assert_type.py:33:5 - error: "assert_type" expects two positional arguments (reportCallIssue)
6+
directives_assert_type.py:22:17 - error: "assert_type" mismatch: expected "int | bool | str" but received "int | str" (reportAssertTypeFailure)
7+
directives_assert_type.py:28:17 - error: "assert_type" mismatch: expected "int" but received "int | str" (reportAssertTypeFailure)
8+
directives_assert_type.py:29:17 - error: "assert_type" mismatch: expected "int" but received "Any" (reportAssertTypeFailure)
9+
directives_assert_type.py:30:17 - error: "assert_type" mismatch: expected "int" but received "Literal[4]" (reportAssertTypeFailure)
10+
directives_assert_type.py:32:5 - error: "assert_type" expects two positional arguments (reportCallIssue)
11+
directives_assert_type.py:33:17 - error: "assert_type" mismatch: expected "int" but received "Literal['']" (reportAssertTypeFailure)
12+
directives_assert_type.py:34:5 - error: "assert_type" expects two positional arguments (reportCallIssue)
913
"""
10-
conformance_automated = "Pass"
14+
conformance_automated = "Fail"
1115
errors_diff = """
16+
Line 22: Unexpected errors ['directives_assert_type.py:22:17 - error: "assert_type" mismatch: expected "int | bool | str" but received "int | str" (reportAssertTypeFailure)']
1217
"""

conformance/results/pyright/generics_syntax_infer_variance.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ generics_syntax_infer_variance.py:29:35 - error: Type "ShouldBeCovariant1[float]
66
  "ShouldBeCovariant1[float]" is not assignable to "ShouldBeCovariant1[int]"
77
    Type parameter "T@ShouldBeCovariant1" is covariant, but "float" is not a subtype of "int"
88
      "float" is not assignable to "int" (reportAssignmentType)
9+
generics_syntax_infer_variance.py:36:37 - error: Cannot instantiate abstract class "ShouldBeCovariant2"
10+
  "Collection.__len__" is not implemented
11+
  "Sequence.__getitem__" is not implemented (reportAbstractUsage)
12+
generics_syntax_infer_variance.py:37:35 - error: Cannot instantiate abstract class "ShouldBeCovariant2"
13+
  "Collection.__len__" is not implemented
14+
  "Sequence.__getitem__" is not implemented (reportAbstractUsage)
915
generics_syntax_infer_variance.py:37:35 - error: Type "ShouldBeCovariant2[float]" is not assignable to declared type "ShouldBeCovariant2[int]"
1016
  "ShouldBeCovariant2[float]" is not assignable to "ShouldBeCovariant2[int]"
1117
    Type parameter "T@ShouldBeCovariant2" is covariant, but "float" is not a subtype of "int"
@@ -57,6 +63,7 @@ generics_syntax_infer_variance.py:155:45 - error: Type "ShouldBeContravariant1[i
5763
    Type parameter "T@ShouldBeContravariant1" is contravariant, but "int" is not a supertype of "float"
5864
      "float" is not assignable to "int" (reportAssignmentType)
5965
"""
60-
conformance_automated = "Pass"
66+
conformance_automated = "Fail"
6167
errors_diff = """
68+
Line 36: Unexpected errors ['generics_syntax_infer_variance.py:36:37 - error: Cannot instantiate abstract class "ShouldBeCovariant2"']
6269
"""

conformance/results/pyright/protocols_definition.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ protocols_definition.py:160:22 - error: Type "Concrete3_Bad5" is not assignable
4646
protocols_definition.py:218:22 - error: Type "Concrete4_Bad1" is not assignable to declared type "Template4"
4747
  "Concrete4_Bad1" is incompatible with protocol "Template4"
4848
    "val1" is an incompatible type
49-
      "function" is not assignable to "Sequence[float]" (reportAssignmentType)
49+
      "FunctionType" is not assignable to "Sequence[float]" (reportAssignmentType)
5050
protocols_definition.py:219:22 - error: Type "Concrete4_Bad2" is not assignable to declared type "Template4"
5151
  "Concrete4_Bad2" is incompatible with protocol "Template4"
5252
    "val1" is not present (reportAssignmentType)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
version = "pyright 1.1.400"
2-
test_duration = 1.1
1+
version = "pyright 1.1.401"
2+
test_duration = 1.5

0 commit comments

Comments
 (0)