Skip to content
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

Do not report class level if TYPE_CHECKING as uncovered #97

Merged
merged 1 commit into from Dec 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -67,7 +67,7 @@ exclude_lines =
^\s*raise$

# typing-related code
^if (False|TYPE_CHECKING):
^\s*if (False|TYPE_CHECKING):
: \.\.\.(\s*#.*)?$
^ +\.\.\.$
-> ['"]?NoReturn['"]?:
Expand Down
2 changes: 1 addition & 1 deletion covdefaults.py
Expand Up @@ -93,7 +93,7 @@ def _version_pragmas(
r'^\s*return NotImplemented\b',
r'^\s*raise$',
# typing-related code
r'^if (False|TYPE_CHECKING):',
r'^\s*if (False|TYPE_CHECKING):',
r': \.\.\.(\s*#.*)?$',
r'^ +\.\.\.$',
r'-> [\'"]?NoReturn[\'"]?:',
Expand Down
2 changes: 2 additions & 0 deletions tests/covdefaults_test.py
Expand Up @@ -167,7 +167,9 @@ def test_exclude_lines_does_not_include_defaults(configured):
' return NotImplemented\n',
' raise\n',
'if False:\n',
' if False:\n',
'if TYPE_CHECKING:\n',
' if TYPE_CHECKING:\n',
'def f(x: int) -> int: ...\n',
'def f(x: int) -> int:\n ...\n',
'def f(x: int) -> C: ...# noqa: F821\n',
Expand Down