Skip to content

Commit

Permalink
Conformance tests: Fix pyright scoring for protocols_variance (python…
Browse files Browse the repository at this point in the history
…#1702)

Pyright produces warnings instead of errors for many issues in this test case.

Part of python#1692
  • Loading branch information
JelleZijlstra committed Apr 11, 2024
1 parent af96dff commit ddb8697
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 9 deletions.
1 change: 1 addition & 0 deletions conformance/results/pyright/protocols_definition.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,4 @@ protocols_definition.py:341:22 - error: Expression of type "Concrete6_Bad3" cann
conformance_automated = "Pass"
errors_diff = """
"""
ignore_errors = ["Static methods should not take a \"self\" or \"cls\" parameter"]
9 changes: 1 addition & 8 deletions conformance/results/pyright/protocols_variance.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@ protocols_variance.py:71:7 - warning: Type variable "T1_contra" used in generic
protocols_variance.py:72:21 - error: Contravariant type variable cannot be used in return type (reportGeneralTypeIssues)
protocols_variance.py:104:7 - warning: Type variable "T1" used in generic protocol "Protocol12" should be covariant (reportInvalidTypeVarUse)
"""
conformance_automated = "Fail"
conformance_automated = "Pass"
errors_diff = """
Line 21: Expected 1 errors
Line 40: Expected 1 errors
Line 56: Expected 1 errors
Line 61: Expected 1 errors
Line 66: Expected 1 errors
Line 71: Expected 1 errors
Line 104: Expected 1 errors
"""
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ qualifiers_final_decorator.py:126:5 - error: Function "func1" cannot be marked @
conformance_automated = "Pass"
errors_diff = """
"""
ignore_errors = ["reportMissingModuleSource"]
2 changes: 1 addition & 1 deletion conformance/src/type_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def parse_errors(self, output: Sequence[str]) -> dict[int, list[str]]:
assert line.count(":") >= 3, f"Failed to parse line: {line!r}"
_, lineno, kind, _ = line.split(":", maxsplit=3)
kind = kind.split()[-1]
if kind != "error":
if kind not in ("error", "warning"):
continue
line_to_errors.setdefault(int(lineno), []).append(line)
return line_to_errors
Expand Down

0 comments on commit ddb8697

Please sign in to comment.