Handling of long lines · Issue #29 · davidfritzsche/pytest-mypy-testing (original) (raw)

In certain cases, we have a mypy assertion like:

@pytest.mark.mypy_testing def test_foo(): link = Link() link1.url = 123 # E: Incompatible types in assignment (expression has type "int", variable has type "Optional[str]")

However, the last line already covers 122-characters. When using Black (which has a default of 88 chars - reference), it'd turn something like:

@pytest.mark.mypy_testing def test_foo(): link = Link() link1.url = ( 123 ) # E: Incompatible types in assignment (expression has type "int", variable has type "Optional[str]")

The issue with this new format is that pytest would error out with something like:

5: error (unexpected): Incompatible types in assignment (expression has type "int", variable has type "Optional[str]")
6: error (missing): Incompatible types in assignment (expression has type "int", variable has type "Optional[str]")

Perhaps there should be another interface that could help declare the assertions aside from comments? or maybe, it should be possible to breakdown the comments into multi-line chunks?