File tree Expand file tree Collapse file tree 1 file changed +28
-1
lines changed
Expand file tree Collapse file tree 1 file changed +28
-1
lines changed Original file line number Diff line number Diff line change 1515 ParseError
1616)
1717from numpydoc .docscrape_sphinx import (SphinxDocString , SphinxClassDoc ,
18- SphinxFunctionDoc )
18+ SphinxFunctionDoc , get_doc_object )
1919from nose .tools import (assert_equal , assert_raises , assert_list_equal ,
2020 assert_true )
2121
@@ -1199,6 +1199,33 @@ def test_templated_sections():
11991199 """ )
12001200
12011201
1202+ def test_nonstandard_property ():
1203+ # test discovery of a property that does not satisfy isinstace(.., property)
1204+
1205+ class SpecialProperty (object ):
1206+
1207+ def __init__ (self , axis = 0 , doc = "" ):
1208+ self .axis = axis
1209+ self .__doc__ = doc
1210+
1211+ def __get__ (self , obj , type ):
1212+ if obj is None :
1213+ # Only instances have actual _data, not classes
1214+ return self
1215+ else :
1216+ return obj ._data .axes [self .axis ]
1217+
1218+ def __set__ (self , obj , value ):
1219+ obj ._set_axis (self .axis , value )
1220+
1221+ class Dummy :
1222+
1223+ attr = SpecialProperty (doc = "test attribute" )
1224+
1225+ doc = get_doc_object (Dummy )
1226+ assert "test attribute" in str (doc )
1227+
1228+
12021229if __name__ == "__main__" :
12031230 import nose
12041231 nose .run ()
You can’t perform that action at this time.
0 commit comments