Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8c03b4d

Browse files
committed
Merged revisions 62486-62487 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r62486 | amaury.forgeotdarc | 2008-04-24 16:22:26 -0400 (Thu, 24 Apr 2008) | 7 lines Add a few tests for pydoc. This is a modified version of a patch proposed by Humberto Diogenes in the discussion of issue1883. I will merge manually this change into the py3k branch: the tests must be adapted. ........ r62487 | amaury.forgeotdarc | 2008-04-24 16:41:50 -0400 (Thu, 24 Apr 2008) | 2 lines Use absolute import for test package ........
1 parent e106dc3 commit 8c03b4d

2 files changed

Lines changed: 33 additions & 1 deletion

File tree

Lib/test/test_pydoc.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
from test import test_support
2+
import unittest
3+
import pydoc
4+
5+
class TestDescriptions(unittest.TestCase):
6+
def test_module(self):
7+
# Check that pydocfodder module can be described
8+
from test import pydocfodder
9+
doc = pydoc.render_doc(pydocfodder)
10+
assert "pydocfodder" in doc
11+
12+
def test_classic_class(self):
13+
class C: "Classic class"
14+
c = C()
15+
self.failUnlessEqual(pydoc.describe(C), 'class C')
16+
self.failUnlessEqual(pydoc.describe(c), 'instance of C')
17+
self.failUnless('instance of C in module test.test_pydoc'
18+
in pydoc.render_doc(c))
19+
20+
def test_class(self):
21+
class C(object): "New-style class"
22+
c = C()
23+
24+
self.failUnlessEqual(pydoc.describe(C), 'class C')
25+
self.failUnlessEqual(pydoc.describe(c), 'C')
26+
self.failUnless('C in module test.test_pydoc object'
27+
in pydoc.render_doc(c))
28+
29+
def test_main():
30+
test_support.run_unittest(TestDescriptions)
31+
32+
if __name__ == "__main__":
33+
unittest.main()

Lib/test/test_sundry.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ def test_at_least_import_untested_modules(self):
8686
import pdb
8787
import pstats
8888
import py_compile
89-
import pydoc
9089
import rlcompleter
9190
import sched
9291
import smtplib

0 commit comments

Comments
 (0)