mirror of
https://github.com/Hopiu/django-model-utils.git
synced 2026-03-16 20:00:23 +00:00
This allows using the latest annotation syntax supported by the type checker regardless of the runtime Python version.
29 lines
913 B
Python
29 lines
913 B
Python
from __future__ import annotations
|
|
|
|
from django.core.management import call_command
|
|
from django.test import TestCase
|
|
|
|
from model_utils.fields import get_excerpt
|
|
|
|
|
|
class MigrationsTests(TestCase):
|
|
def test_makemigrations(self):
|
|
call_command('makemigrations', dry_run=True)
|
|
|
|
|
|
class GetExcerptTests(TestCase):
|
|
def test_split(self):
|
|
e = get_excerpt("some content\n\n<!-- split -->\n\nsome more")
|
|
self.assertEqual(e, 'some content\n')
|
|
|
|
def test_auto_split(self):
|
|
e = get_excerpt("para one\n\npara two\n\npara three")
|
|
self.assertEqual(e, 'para one\n\npara two')
|
|
|
|
def test_middle_of_para(self):
|
|
e = get_excerpt("some text\n<!-- split -->\nmore text")
|
|
self.assertEqual(e, 'some text')
|
|
|
|
def test_middle_of_line(self):
|
|
e = get_excerpt("some text <!-- split --> more text")
|
|
self.assertEqual(e, "some text <!-- split --> more text")
|