--- /dev/null
+from test import test_support\r
+import unittest\r
+import pydoc\r
+\r
+class TestDescriptions(unittest.TestCase):\r
+ def test_module(self):\r
+ # Check that pydocfodder module can be described\r
+ from test import pydocfodder\r
+ doc = pydoc.render_doc(pydocfodder)\r
+ assert "pydocfodder" in doc\r
+\r
+ def test_classic_class(self):\r
+ class C: "Classic class"\r
+ c = C()\r
+ self.failUnlessEqual(pydoc.describe(C), 'class C')\r
+ self.failUnlessEqual(pydoc.describe(c), 'instance of C')\r
+ self.failUnless('instance of C in module test.test_pydoc'\r
+ in pydoc.render_doc(c))\r
+\r
+ def test_class(self):\r
+ class C(object): "New-style class"\r
+ c = C()\r
+\r
+ self.failUnlessEqual(pydoc.describe(C), 'class C')\r
+ self.failUnlessEqual(pydoc.describe(c), 'C')\r
+ self.failUnless('C in module test.test_pydoc object'\r
+ in pydoc.render_doc(c))\r
+\r
+def test_main():\r
+ test_support.run_unittest(TestDescriptions)\r
+\r
+if __name__ == "__main__":\r
+ unittest.main()\r