mirror of
https://github.com/Hopiu/django-modeltranslation.git
synced 2026-03-16 22:10:31 +00:00
fix test
This commit is contained in:
parent
89c51096bc
commit
9a3aebf6cd
3 changed files with 6 additions and 3 deletions
|
|
@ -37,5 +37,4 @@ def monkeypatch() -> None:
|
|||
return cls
|
||||
|
||||
for cls in classes:
|
||||
if not hasattr(cls, "__class_getitem__"):
|
||||
cls.__class_getitem__ = classmethod(class_getitem) # type: ignore[attr-defined]
|
||||
cls.__class_getitem__ = classmethod(class_getitem) # type: ignore[attr-defined]
|
||||
|
|
|
|||
|
|
@ -2,9 +2,11 @@ import os
|
|||
import warnings
|
||||
|
||||
import django_stubs_ext
|
||||
from modeltranslation._typing import monkeypatch
|
||||
|
||||
warnings.simplefilter("always", DeprecationWarning)
|
||||
django_stubs_ext.monkeypatch()
|
||||
monkeypatch()
|
||||
|
||||
|
||||
def _get_database_config():
|
||||
|
|
|
|||
|
|
@ -2912,11 +2912,13 @@ class TranslationAdminTest(ModeltranslationTestBase):
|
|||
assert tuple(ma.get_form(request, self.test_obj).base_fields.keys()) == tuple(fields)
|
||||
|
||||
def test_class_attribute_access_raises_type_error(self):
|
||||
# Test for django-cms compatibility
|
||||
# https://github.com/django-cms/django-cms/issues/7948
|
||||
class TestModelAdmin(admin.TranslationAdmin[models.TestModel]):
|
||||
allow_children = True
|
||||
|
||||
with pytest.raises(KeyError):
|
||||
TestModelAdmin["allow_children"] # type: ignore
|
||||
TestModelAdmin["allow_children"]
|
||||
|
||||
|
||||
class ThirdPartyAppIntegrationTest(ModeltranslationTestBase):
|
||||
|
|
|
|||
Loading…
Reference in a new issue