-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add new setting to enforce future imports for all annotations
- Loading branch information
Showing
5 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import textwrap | ||
|
||
from flake8_type_checking.constants import TC100 | ||
from tests.conftest import _get_error | ||
|
||
|
||
def test_force_future_annotation(): | ||
"""TC100 should be emitted even if there are no forward references to typing-only symbols.""" | ||
example = textwrap.dedent( | ||
''' | ||
from x import Y | ||
a: Y | ||
''' | ||
) | ||
assert _get_error(example, error_code_filter='TC100', type_checking_force_future_annotation=False) == set() | ||
assert _get_error(example, error_code_filter='TC100', type_checking_force_future_annotation=True) == { | ||
'1:0 ' + TC100 | ||
} |