Skip to content

Erroneous coverage indication in html report when type checking stops due to impossible assert #2785

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
axch opened this issue Feb 1, 2017 · 2 comments
Assignees
Labels
bug mypy got something wrong

Comments

@axch
Copy link

axch commented Feb 1, 2017

The html report for checking coverage of the situation from Issue #2776 misrepresents the unchecked code lines. Specifically, the example is

class A(object): pass

class C(object): pass

def bar(x):
    # type: (A) -> None
    reveal_type(x)
    assert isinstance(x, C)
    reveal_type(x)

The report generated by --html-report indicates that the whole file is covered, even though the second reveal_type produces no output (which problem itself is #2776). Inspecting the source indicates that the second reveal_type is classified as "line-empty", which visually looks like "line-precise", and in this circumstance is misleading.

@gvanrossum
Copy link
Member

gvanrossum commented Feb 1, 2017 via email

@axch
Copy link
Author

axch commented Feb 1, 2017

+1 for marking dead code differently.

@JukkaL JukkaL added the bug mypy got something wrong label Feb 7, 2017
ilinum added a commit to ilinum/mypy that referenced this issue Jun 26, 2017
@ilinum ilinum closed this as completed in 6c61c66 Jul 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

No branches or pull requests

4 participants