Coverage for tests/test_models.py: 100%
11 statements
« prev ^ index » next coverage.py v7.2.7, created at 2024-08-27 18:25 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2024-08-27 18:25 +0000
1from typing import TYPE_CHECKING
3import pytest
5from prisma.models import User
7# pyright: reportUnusedClass=false
10def test_subclass_warn_subclass_argument_deprecated() -> None:
11 """The class argument `wan_subclass` is deprecated"""
12 # For some indiscernible reason, this code causes mypy to crash...
13 #
14 # The `exclude` option doesn't help us because of the way mypy works it still causes it to crash.
15 #
16 # I do not have the time nor the willpower to investigate why this happens so we resort to this solution.
17 if not TYPE_CHECKING:
18 with pytest.warns(
19 DeprecationWarning,
20 match='The `warn_subclass` argument is deprecated',
21 ):
23 class MyUser(User, warn_subclass=False):
24 pass
26 with pytest.warns(
27 DeprecationWarning,
28 match='The `warn_subclass` argument is deprecated',
29 ):
31 class MyUser2(User, warn_subclass=True):
32 pass