Permalink
Browse files

Add test for oinspect.getdoc

  • Loading branch information...
takluyver committed Nov 30, 2011
1 parent 07add9d commit 72ad5d8a018fde98793e2cea61ed279f28fec58d
Showing with 16 additions and 0 deletions.
  1. +16 −0 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")

0 comments on commit 72ad5d8

Please sign in to comment.