Skip to content

Commit

Permalink
Do not report class level if TYPE_CHECKING as uncovered
Browse files Browse the repository at this point in the history
Closes #96
  • Loading branch information
sobolevn authored and asottile committed Dec 3, 2022
1 parent 9d6e5c5 commit f586651
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
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

0 comments on commit f586651

Please sign in to comment.