summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_pydoc.py
blob: cc4a096f00d6e07ed720a0e1f9ebf3178cb6854f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from test import support
import unittest
import pydoc

class TestDescriptions(unittest.TestCase):
    def test_module(self):
        # Check that pydocfodder module can be described

        from test import pydocfodder
        doc = pydoc.render_doc(pydocfodder)
        assert "pydocfodder" in doc

    def test_class(self):
        class C(object): "New-style class"
        c = C()

        self.failUnlessEqual(pydoc.describe(C), 'class C')
        self.failUnlessEqual(pydoc.describe(c), 'C')
        self.failUnless('C in module test.test_pydoc object'
                        in pydoc.render_doc(c))

def test_main():
    support.run_unittest(TestDescriptions)

if __name__ == "__main__":
    unittest.main()