diff options
author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-12-28 14:55:54 +0100 |
---|---|---|
committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2013-12-28 20:53:00 +0100 |
commit | ba7206cd81458865bace85914905392291b05829 (patch) | |
tree | f08d8ee4e1111e71bfd13a824fa35ac8cc2ba791 /tests/app_loading | |
parent | 54790e669d73269bea6320c947ed8a46e98b8025 (diff) | |
download | django-ba7206cd81458865bace85914905392291b05829.tar.gz |
Changed get_model to raise an exception on errors.
Returning None on errors required unpythonic error checking and was
inconsistent with get_app_config.
get_model was a private API until the previous commit, but given that it
was certainly used in third party software, the change is explained in
the release notes.
Applied the same change to get_registered_model, which is a new private
API introduced during the recent refactoring.
Diffstat (limited to 'tests/app_loading')
-rw-r--r-- | tests/app_loading/tests.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/app_loading/tests.py b/tests/app_loading/tests.py index d61205330a..04ca30e88d 100644 --- a/tests/app_loading/tests.py +++ b/tests/app_loading/tests.py @@ -72,8 +72,8 @@ class GetModelsTest(TestCase): self.not_installed_module = models def test_get_model_only_returns_installed_models(self): - self.assertEqual( - apps.get_model("not_installed", "NotInstalledModel"), None) + with self.assertRaises(LookupError): + apps.get_model("not_installed", "NotInstalledModel") def test_get_models_only_returns_installed_models(self): self.assertNotIn( |