diff options
author | Hasan Ramezani <hasan.r67@gmail.com> | 2020-12-21 14:21:25 +0100 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-12-22 13:26:30 +0100 |
commit | 8b2a30f6f16cb1f3538847954030d69da005bc7f (patch) | |
tree | 130ac74131cc6bb7625d6805ddd99c41dc55e5f6 /tests/apps | |
parent | 110001d0bbbabe2a5b57b14a59bd0e4b71bf2712 (diff) | |
download | django-8b2a30f6f16cb1f3538847954030d69da005bc7f.tar.gz |
Fixed #32285 -- Raised ImproperlyConfigured when AppConfig.label is not a valid Python identifier.
Diffstat (limited to 'tests/apps')
-rw-r--r-- | tests/apps/tests.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/apps/tests.py b/tests/apps/tests.py index 0e1f918bcc..a8a93ce683 100644 --- a/tests/apps/tests.py +++ b/tests/apps/tests.py @@ -436,6 +436,14 @@ class AppConfigTests(SimpleTestCase): ac = AppConfig('label', Stub(__path__=['a'])) self.assertEqual(repr(ac), '<AppConfig: label>') + def test_invalid_label(self): + class MyAppConfig(AppConfig): + label = 'invalid.label' + + msg = "The app label 'invalid.label' is not a valid Python identifier." + with self.assertRaisesMessage(ImproperlyConfigured, msg): + MyAppConfig('test_app', Stub()) + @override_settings( INSTALLED_APPS=['apps.apps.ModelPKAppsConfig'], DEFAULT_AUTO_FIELD='django.db.models.SmallAutoField', |