@@ -46,7 +46,9 @@ class ITaggedValuesSchema(model.Schema):
46
46
47
47
parametrized_widget_field = schema .TextLine (title = "Parametrized widget field" )
48
48
form .widget (
49
- "parametrized_widget_field" , a_param = "some_value" , defaultFactory = lambda : "Foo"
49
+ "parametrized_widget_field" ,
50
+ a_param = "some_value" ,
51
+ defaultFactory = lambda : "Foo" ,
50
52
)
51
53
52
54
not_parametrized_widget_field = schema .TextLine (
@@ -459,7 +461,11 @@ def test_decimal(self):
459
461
460
462
def test_int (self ):
461
463
field = schema .Int (
462
- title = "My field" , description = "My great field" , min = 0 , max = 100 , default = 50
464
+ title = "My field" ,
465
+ description = "My great field" ,
466
+ min = 0 ,
467
+ max = 100 ,
468
+ default = 50 ,
463
469
)
464
470
adapter = getMultiAdapter (
465
471
(field , self .portal , self .request ), IJsonSchemaProvider
@@ -742,9 +748,33 @@ def test_richtext(self):
742
748
adapter .get_schema (),
743
749
)
744
750
751
+ def test_richtext_with_default (self ):
752
+ field = RichText (
753
+ title = "My field" ,
754
+ description = "My great field" ,
755
+ default = "<p>Some default value</p>" ,
756
+ )
757
+ adapter = getMultiAdapter (
758
+ (field , self .portal , self .request ), IJsonSchemaProvider
759
+ )
760
+
761
+ self .assertEqual (
762
+ {
763
+ "type" : "string" ,
764
+ "title" : "My field" ,
765
+ "factory" : "Rich Text" ,
766
+ "description" : "My great field" ,
767
+ "widget" : "richtext" ,
768
+ "default" : "<p>Some default value</p>" ,
769
+ },
770
+ adapter .get_schema (),
771
+ )
772
+
745
773
def test_date (self ):
746
774
field = schema .Date (
747
- title = "My field" , description = "My great field" , default = date (2016 , 1 , 1 )
775
+ title = "My field" ,
776
+ description = "My great field" ,
777
+ default = date (2016 , 1 , 1 ),
748
778
)
749
779
adapter = getMultiAdapter (
750
780
(field , self .portal , self .request ), IJsonSchemaProvider
@@ -781,7 +811,9 @@ def test_datetime(self):
781
811
782
812
def test_jsonfield (self ):
783
813
field = JSONField (
784
- title = "My field" , description = "My great field" , widget = "my_widget_name"
814
+ title = "My field" ,
815
+ description = "My great field" ,
816
+ widget = "my_widget_name" ,
785
817
)
786
818
adapter = getMultiAdapter (
787
819
(field , self .portal , self .request ), IJsonSchemaProvider
0 commit comments