Files
django-stubs/test/test-data/check-parse-settings.test
2018-11-18 15:58:17 +03:00

31 lines
856 B
Plaintext

[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]