Skip to content

Commit

Permalink
chore: Add type hint test
Browse files Browse the repository at this point in the history
Refs  #758
  • Loading branch information
mschoettle authored Sep 5, 2024
1 parent 01553b6 commit 58894dc
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion modeltranslation/tests/test_runtime_typing.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
from modeltranslation import admin
import sys
from typing import get_type_hints

import pytest

from modeltranslation import admin, translator
from modeltranslation.tests import models


Expand All @@ -10,3 +15,19 @@ class TestInlineModelAdmin(
admin.TranslationInlineModelAdmin[models.ForeignKeyModel, models.TestModel]
):
pass


@pytest.mark.skipif(
sys.version_info < (3, 10),
reason="get_type_hints fails on Python 3.9 despite future annotations",
)
@pytest.mark.parametrize(
"cls",
[
translator.TranslationOptions,
admin.TranslationAdmin,
admin.TranslationInlineModelAdmin,
],
)
def test_type_hints(cls):
get_type_hints(cls)

0 comments on commit 58894dc

Please sign in to comment.