diff --git a/README.md b/README.md index 08a0078..2761af0 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ exclude_lines = ^\s*raise$ # typing-related code - ^if (False|TYPE_CHECKING): + ^\s*if (False|TYPE_CHECKING): : \.\.\.(\s*#.*)?$ ^ +\.\.\.$ -> ['"]?NoReturn['"]?: diff --git a/covdefaults.py b/covdefaults.py index 55a5120..09b40a9 100644 --- a/covdefaults.py +++ b/covdefaults.py @@ -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[\'"]?:', diff --git a/tests/covdefaults_test.py b/tests/covdefaults_test.py index 7d124ba..bc3f1bc 100644 --- a/tests/covdefaults_test.py +++ b/tests/covdefaults_test.py @@ -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',