Skip to content

Commit

Permalink
feat: 增加简介字段ReadmeField,单元测试通过
Browse files Browse the repository at this point in the history
  • Loading branch information
Guo-Zhang committed Aug 23, 2023
1 parent 2ac8dca commit e418da0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
3 changes: 2 additions & 1 deletion django_quanttide/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from .choices import StageChoices
from .fields import (
IDField, NumberField, NameField,
VerboseNameField, TitleField, DescriptionField,
VerboseNameField, TitleField, DescriptionField, ReadmeField,
TypeField, StatusField, StageField,
CreatedAtField, UpdatedAtField,
CreatedByField, UpdatedByField,
Expand All @@ -20,6 +20,7 @@
'VerboseNameField',
'TitleField',
'DescriptionField',
'ReadmeField',
'TypeField',
'StatusField',
'StageField',
Expand Down
20 changes: 19 additions & 1 deletion tests/test_models_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from django_quanttide.models import (
IDField, NumberField, NameField,
VerboseNameField, TitleField, DescriptionField,
VerboseNameField, TitleField, DescriptionField, ReadmeField,
TypeField, StatusField, StageField, StageChoices,
CreatedAtField, UpdatedAtField,
CreatedByField, UpdatedByField,
Expand Down Expand Up @@ -112,6 +112,24 @@ def test_custom_options(self):
self.assertEqual(field.verbose_name, '关联描述')


class ReadmeFieldTestCase(SimpleTestCase):

def test_defaults(self):
field = ReadmeField()
self.assertEqual(field.default, None)
self.assertTrue(field.blank)
self.assertTrue(field.null)
self.assertEqual(field.verbose_name, '简介')

def test_custom_options(self):
field = ReadmeField(default='test', blank=False, null=False, verbose_name='关联简介')
self.assertEqual(field.default, 'test')
self.assertFalse(field.blank)
self.assertFalse(field.null)
self.assertEqual(field.verbose_name, '关联简介')



class TypeFieldTestCase(SimpleTestCase):

def test_defaults(self):
Expand Down

0 comments on commit e418da0

Please sign in to comment.