summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2008-05-18 20:48:07 (GMT)
committerBenjamin Peterson <benjamin@python.org>2008-05-18 20:48:07 (GMT)
commitf5c38dadf6b60839812fa450091cbbbed0a42655 (patch)
treebf474c1888457e770bedd5dfb841232f7d3d757c /Lib/test
parent6cc9fd7bd51affef65c334fb9161f0a36fd2de83 (diff)
downloadcpython-f5c38dadf6b60839812fa450091cbbbed0a42655.zip
cpython-f5c38dadf6b60839812fa450091cbbbed0a42655.tar.gz
cpython-f5c38dadf6b60839812fa450091cbbbed0a42655.tar.bz2
bring test_pydoc up to my high standards (now that I have them)
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_pydoc.py36
1 files changed, 17 insertions, 19 deletions
diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py
index a99fa24..6c10ebf 100644
--- a/Lib/test/test_pydoc.py
+++ b/Lib/test/test_pydoc.py
@@ -5,6 +5,7 @@ import re
import pydoc
import unittest
import test.test_support
+
from test import pydoc_mod
expected_text_pattern = \
@@ -201,16 +202,6 @@ def get_mod_file(module):
return mod_file if mod_file.endswith("py") else mod_file[:-3] + "py"
-class CLINotHereTest(unittest.TestCase):
-
- def test_not_here(self):
- missing_module = "test.i_am_not_here"
- result = run_pydoc(missing_module)
- expected = missing_pattern % missing_module
- self.assertEqual(expected, result,
- "documentation for missing module found")
-
-
class PyDocDocTest(unittest.TestCase):
def test_html_doc(self):
@@ -228,35 +219,42 @@ class PyDocDocTest(unittest.TestCase):
print_diffs(result, expected_text)
self.fail("outputs are not equal, see diff above")
+ def test_not_here(self):
+ missing_module = "test.i_am_not_here"
+ result = run_pydoc(missing_module)
+ expected = missing_pattern % missing_module
+ self.assertEqual(expected, result,
+ "documentation for missing module found")
+
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
+ self.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'
+ self.assertEqual(pydoc.describe(C), 'class C')
+ self.assertEqual(pydoc.describe(c), 'instance of C')
+ self.assert_('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'
+ self.assertEqual(pydoc.describe(C), 'class C')
+ self.assertEqual(pydoc.describe(c), 'C')
+ self.assert_('C in module test.test_pydoc object'
in pydoc.render_doc(c))
def test_main():
- test.test_support.run_unittest(CLINotHereTest,
- PyDocDocTest,
+ test.test_support.run_unittest(PyDocDocTest,
TestDescriptions)
if __name__ == "__main__":