Skip to content

Commit 53e9f57

Browse files
committed
Improve error message
1 parent 43483a3 commit 53e9f57

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ plugins = ["pdm-autoexport"]
2020
[tool.pdm.scripts]
2121
devserver = "flask --app app run --debug"
2222
activate = "eval $(pdm venv activate)"
23+
test = "pytest"
2324

2425
[tool.pdm.dev-dependencies]
2526
dev = [

tests/test_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ def test_run_type_check_with_pyright():
1515
assert result.passed is False
1616
assert result.stdout == (
1717
'4:error: Expression of type "Literal[4]" cannot be assigned to declared type "str"\n'
18-
"2: error: Expected type error\n\n"
18+
"2: error: Expected type error but instead passed\n\n"
1919
"Found 2 errors"
2020
)

views/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,9 @@ def _type_check_with_pyright(cls, code: str) -> TypeCheckResult:
130130
# If there are any lines that are expected to fail but not reported by pyright,
131131
# they should be considered as errors.
132132
for line_number in expect_error_line_numbers:
133-
error_lines.append(f"{line_number}: error: Expected type error")
133+
error_lines.append(
134+
f"{line_number}: error: Expected type error but instead passed"
135+
)
134136

135137
passed = len(error_lines) == 0
136138
if passed:

0 commit comments

Comments
 (0)