File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -889,7 +889,10 @@ def text(self, **kwargs) -> str:
889889 Returns the documentation for this module as plain text.
890890 """
891891 txt = _render_template ('/text.mako' , module = self , ** kwargs )
892- return re .sub ("\n \n \n +" , "\n \n " , txt )
892+ txt = re .sub ("\n \n \n +" , "\n \n " , txt )
893+ if not txt .endswith ('\n ' ):
894+ txt += '\n '
895+ return txt
893896
894897 def html (self , minify = True , ** kwargs ) -> str :
895898 """
Original file line number Diff line number Diff line change @@ -1200,6 +1200,10 @@ def test_mock_signature_error(self):
12001200 # GH-350 -- throws `TypeError: 'Mock' object is not subscriptable`:
12011201 self .assertIsInstance (inspect .signature (Mock (spec = lambda x : x )), inspect .Signature )
12021202
1203+ def test_ends_with_newline (self ):
1204+ self .assertEqual ('\n ' , DUMMY_PDOC_MODULE .text ()[- 1 ])
1205+ self .assertEqual ('\n ' , DUMMY_PDOC_MODULE .html ()[- 1 ])
1206+
12031207
12041208class HtmlHelpersTest (unittest .TestCase ):
12051209 """
You can’t perform that action at this time.
0 commit comments