-
-
Notifications
You must be signed in to change notification settings - Fork 454
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests: Add test case for settings import cycle (#2098)
- Loading branch information
Showing
1 changed file
with
22 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
- case: test_setting_circular_import | ||
main: | | ||
from myapp import lib | ||
custom_settings: | | ||
from myapp.lib import function_returning_int | ||
IMMEDIATE_VALUE = 123 | ||
CIRCULAR_WITHOUT_HINT = function_returning_int() | ||
CIRCULAR_WITH_HINT: int = function_returning_int() | ||
files: | ||
- path: myapp/__init__.py | ||
- path: myapp/lib.py | ||
content: | | ||
from django.conf import settings | ||
def test() -> None: | ||
reveal_type(settings.IMMEDIATE_VALUE) # N: Revealed type is "builtins.int" | ||
reveal_type(settings.CIRCULAR_WITHOUT_HINT) # E: Import cycle from Django settings module prevents type inference for 'CIRCULAR_WITHOUT_HINT' [misc] # N: Revealed type is "Any" | ||
reveal_type(settings.CIRCULAR_WITH_HINT) # N: Revealed type is "builtins.int" | ||
def function_returning_int() -> int: | ||
return 42 |