diff options
author | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2008-04-24 20:48:12 (GMT) |
---|---|---|
committer | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2008-04-24 20:48:12 (GMT) |
commit | 8c03b4de9db8dfaccc93916af61baf6ff4f1c9b2 (patch) | |
tree | 4f13ddeda990930bf1a122941112871d9e41e92e /Lib | |
parent | e106dc3cf6eb32a54ca8274963a09904cd936025 (diff) | |
download | cpython-8c03b4de9db8dfaccc93916af61baf6ff4f1c9b2.zip cpython-8c03b4de9db8dfaccc93916af61baf6ff4f1c9b2.tar.gz cpython-8c03b4de9db8dfaccc93916af61baf6ff4f1c9b2.tar.bz2 |
Merged revisions 62486-62487 via svnmerge from
svn+ssh://pythondev@svn.python.org/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
........
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_pydoc.py | 33 | ||||
-rw-r--r-- | Lib/test/test_sundry.py | 1 |
2 files changed, 33 insertions, 1 deletions
diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py new file mode 100644 index 0000000..d9670fb --- /dev/null +++ b/Lib/test/test_pydoc.py @@ -0,0 +1,33 @@ +from test import test_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_classic_class(self):
+ class C: "Classic class"
+ c = C()
+ self.failUnlessEqual(pydoc.describe(C), 'class C')
+ self.failUnlessEqual(pydoc.describe(c), 'instance of C')
+ self.failUnless('instance of C in module test.test_pydoc'
+ in pydoc.render_doc(c))
+
+ 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():
+ test_support.run_unittest(TestDescriptions)
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/Lib/test/test_sundry.py b/Lib/test/test_sundry.py index 64a9690..77d3f88 100644 --- a/Lib/test/test_sundry.py +++ b/Lib/test/test_sundry.py @@ -86,7 +86,6 @@ class TestUntestedModules(unittest.TestCase): import pdb import pstats import py_compile - import pydoc import rlcompleter import sched import smtplib |