Skip to content

Commit

Permalink
Merge pull request #97 from sobolevn/patch-1
Browse files Browse the repository at this point in the history
Do not report class level `if TYPE_CHECKING` as uncovered
  • Loading branch information
asottile authored Dec 3, 2022
2 parents 9d6e5c5 + f586651 commit b0d8d82
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 b0d8d82

Please sign in to comment.