Expected block is not correctly formatted with all lines printed as <45 (diff). For example if I try to test:
- case: failing_case_1
main: |
reveal_type(42) # N: Revealed type is "builtins.str"
reveal_type("foo") # N: Revealed type is "builtins.int"
I get
/path/to/test-file.yaml:3:
E pytest_mypy_plugins.utils.TypecheckAssertionError: Invalid output:
E Expected:
E <45 (diff)
E <45 (diff)
E Actual:
E main:1: note: Revealed type is "Literal[42]?" (diff)
E main:2: note: Revealed type is "Literal['foo']?" (diff)
E
E Alignment of first line difference:
E E: ...te: Revealed type is "builtins.str"
E A: ...te: Revealed type is "Literal[42]?"
E ^
while I expect
/path/to/test-file.yaml:3:
E pytest_mypy_plugins.utils.TypecheckAssertionError: Output is not expected:
E Actual:
E main:1: note: Revealed type is "Literal[42]?" (diff)
E main:2: note: Revealed type is "Literal['foo']?" (diff)
E Expected:
E main:1: note: Revealed type is "builtins.str" (diff)
E main:2: note: Revealed type is "builtins.int" (diff)
E Alignment of first line difference:
E E: ...te: Revealed type is "builtins.str"
E A: ...te: Revealed type is "Literal[42]?"
This happens because OutputMatcher is fed directly into str.format, instead of converting it first to str
Expected block is not correctly formatted with all lines printed as
<45 (diff)
. For example if I try to test:I get
while I expect
This happens because
OutputMatcher
is fed directly intostr.format
, instead of converting it first tostr
https://github.com/typeddjango/pytest-mypy-plugins/blob/f7b249d0e40c25e2979adfbdb804a2e489072837/pytest_mypy_plugins/utils.py#L254
See for example:
Environment:
pytest-mypy-plugins
: 1.9.1