django-model-utils/tests/test_managers/test_status_manager.py
Maarten ter Huurne aeeb69a9dd Enable postponed evaluation of annotations for all test modules
This allows using the latest annotation syntax supported by the type
checker regardless of the runtime Python version.
2024-06-13 12:02:05 +02:00

23 lines
763 B
Python

from __future__ import annotations
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.test import TestCase
from model_utils.managers import QueryManager
from model_utils.models import StatusModel
from tests.models import StatusManagerAdded
class StatusManagerAddedTests(TestCase):
def test_manager_available(self):
self.assertTrue(isinstance(StatusManagerAdded.active, QueryManager))
def test_conflict_error(self):
with self.assertRaises(ImproperlyConfigured):
class ErrorModel(StatusModel):
STATUS = (
('active', 'Is Active'),
('deleted', 'Is Deleted'),
)
active = models.BooleanField()