From 72ad5d8a018fde98793e2cea61ed279f28fec58d 2011-11-30 21:06:40 From: Thomas Kluyver Date: 2011-11-30 21:06:40 Subject: [PATCH] Add test for oinspect.getdoc --- diff --git a/IPython/core/tests/test_oinspect.py b/IPython/core/tests/test_oinspect.py index 129d45a..00bc5b6 100644 --- a/IPython/core/tests/test_oinspect.py +++ b/IPython/core/tests/test_oinspect.py @@ -134,3 +134,19 @@ def test_info(): i = inspector.info(OldStyle()) nt.assert_equal(i['type_name'], 'instance') nt.assert_equal(i['docstring'], OldStyle.__doc__) + +def test_getdoc(): + class A(object): + """standard docstring""" + pass + + class B(object): + """standard docstring""" + def getdoc(self): + return "custom docstring" + + a = A() + b = B() + + nt.assert_equal(oinspect.getdoc(a), "standard docstring") + nt.assert_equal(oinspect.getdoc(b), "custom docstring")