File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ class _DocModifier(_schema.PropertyModifier):
1616 doc : str
1717
1818 def modify (self , prop : _schema .Property ):
19+ if "\n " in self .doc or self .doc [- 1 ] == "." :
20+ raise _schema .Error ("No newlines or trailing dots are allowed in doc, did you intend to use desc?" )
1921 prop .doc = self .doc
2022
2123
Original file line number Diff line number Diff line change @@ -559,6 +559,22 @@ class A:
559559 }
560560
561561
562+ def test_property_doc_override_no_newlines ():
563+ with pytest .raises (schema .Error ):
564+ @schema .load
565+ class data :
566+ class A :
567+ x : int | defs .doc ("no multiple\n lines" )
568+
569+
570+ def test_property_doc_override_no_trailing_dot ():
571+ with pytest .raises (schema .Error ):
572+ @schema .load
573+ class data :
574+ class A :
575+ x : int | defs .doc ("no dots please." )
576+
577+
562578def test_class_default_doc_name ():
563579 @schema .load
564580 class data :
You can’t perform that action at this time.
0 commit comments