mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-16 00:37:11 +08:00
add support for django.conf.settings.SETTING_NAME
This commit is contained in:
31
test/test-data/check-parse-settings.test
Normal file
31
test/test-data/check-parse-settings.test
Normal file
@@ -0,0 +1,31 @@
|
||||
[case testParseSettingsFromFile]
|
||||
from django.conf import settings
|
||||
|
||||
reveal_type(settings.ROOT_DIR) # E: Revealed type is 'builtins.str'
|
||||
reveal_type(settings.OBJ) # E: Revealed type is 'django.utils.functional.LazyObject'
|
||||
reveal_type(settings.NUMBERS) # E: Revealed type is 'builtins.list[Any]'
|
||||
reveal_type(settings.DICT) # E: Revealed type is 'builtins.dict[Any, Any]'
|
||||
|
||||
[file mysettings.py]
|
||||
SECRET_KEY = 112233
|
||||
ROOT_DIR = '/etc'
|
||||
NUMBERS = ['one', 'two']
|
||||
DICT = {}
|
||||
|
||||
from django.utils.functional import LazyObject
|
||||
OBJ = LazyObject()
|
||||
|
||||
[env DJANGO_SETTINGS_MODULE=mysettings]
|
||||
[out]
|
||||
|
||||
[case testSettingIsInitializedToNone]
|
||||
from django.conf import settings
|
||||
|
||||
reveal_type(settings.NONE_SETTING) # E: Revealed type is 'builtins.object'
|
||||
|
||||
[file mysettings_not_none.py]
|
||||
SECRET_KEY = 112233
|
||||
NONE_SETTING = None
|
||||
|
||||
[env DJANGO_SETTINGS_MODULE=mysettings_not_none]
|
||||
[out]
|
||||
Reference in New Issue
Block a user