Debian Codegraph @

tests/test_miscellaneous.py

raw
1 from __future__ import annotations
2
3 from django.core.management import call_command
4 from django.test import TestCase
5
6 from model_utils.fields import get_excerpt
7
8
9 class MigrationsTests(TestCase):
10 def test_makemigrations(self) -> None:
11 call_command('makemigrations', dry_run=True)
12
13
14 class GetExcerptTests(TestCase):
15 def test_split(self) -> None:
16 e = get_excerpt("some content\n\n<!-- split -->\n\nsome more")
17 self.assertEqual(e, 'some content\n')
18
19 def test_auto_split(self) -> None:
20 e = get_excerpt("para one\n\npara two\n\npara three")
21 self.assertEqual(e, 'para one\n\npara two')
22
23 def test_middle_of_para(self) -> None:
24 e = get_excerpt("some text\n<!-- split -->\nmore text")
25 self.assertEqual(e, 'some text')
26
27 def test_middle_of_line(self) -> None:
28 e = get_excerpt("some text <!-- split --> more text")
29 self.assertEqual(e, "some text <!-- split --> more text")