File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -156,7 +156,7 @@ def __init__(
156156 self .description = description
157157 self .required = required
158158 self .readonly = readonly
159- self .example = example or self .__schema_example__
159+ self .example = example if example is not None else self .__schema_example__
160160 self .mask = mask
161161
162162 def format (self , value ):
Original file line number Diff line number Diff line change @@ -298,6 +298,14 @@ def test_with_default(self):
298298 assert not field .required
299299 assert field .__schema__ == {"type" : "boolean" , "default" : True }
300300
301+ def test_with_example (self ):
302+ field = fields .Boolean (default = True , example = False )
303+ assert field .__schema__ == {
304+ "type" : "boolean" ,
305+ "default" : True ,
306+ "example" : False ,
307+ }
308+
301309 @pytest .mark .parametrize (
302310 "value,expected" ,
303311 [
You can’t perform that action at this time.
0 commit comments