File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ def is_empty(self):
91
91
92
92
class ParseError (Exception ):
93
93
def __str__ (self ):
94
- message = self .message
94
+ message = self .args [ 0 ]
95
95
if hasattr (self , 'docstring' ):
96
96
message = "%s in %r" % (message , self .docstring )
97
97
return message
Original file line number Diff line number Diff line change 6
6
7
7
import jinja2
8
8
9
- from numpydoc .docscrape import NumpyDocString , FunctionDoc , ClassDoc
9
+ from numpydoc .docscrape import (
10
+ NumpyDocString ,
11
+ FunctionDoc ,
12
+ ClassDoc ,
13
+ ParseError
14
+ )
10
15
from numpydoc .docscrape_sphinx import SphinxDocString , SphinxClassDoc
11
16
from nose .tools import *
12
17
@@ -635,6 +640,23 @@ def test_see_also():
635
640
elif func == 'class_j' :
636
641
assert desc == ['fubar' , 'foobar' ]
637
642
643
+
644
+ def test_see_also_parse_error ():
645
+ text = (
646
+ """
647
+ z(x,theta)
648
+
649
+ See Also
650
+ --------
651
+ :func:`~foo`
652
+ """ )
653
+ with assert_raises (ParseError ) as err :
654
+ NumpyDocString (text )
655
+ assert_equal (
656
+ str (r":func:`~foo` is not a item name in '\n z(x,theta)\n\n See Also\n --------\n :func:`~foo`\n '" ),
657
+ str (err .exception )
658
+ )
659
+
638
660
def test_see_also_print ():
639
661
class Dummy (object ):
640
662
"""
You can’t perform that action at this time.
0 commit comments