Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provide tests for wrong dict access of admin class not raising TypeError #749

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions modeltranslation/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2422,6 +2422,19 @@ def tearDown(self):
self.test_obj.delete()
super().tearDown()

def test_admin_class_dict_access_raises_type_error(self):

class TestModelAdmin(admin.TranslationAdmin):
my_attribute = "default"

try:
test = TestModelAdmin["my_attribute"]
# don't know how to fail here?!
# as we should have a type error!
assert True == False
except TypeError:
pass

def test_default_fields(self):
class TestModelAdmin(admin.TranslationAdmin):
pass
Expand Down
Loading