]> granicus.if.org Git - python/commitdiff
#17464: improve pydoc test coverage.
authorR David Murray <rdmurray@bitdance.com>
Tue, 19 Mar 2013 04:00:33 +0000 (00:00 -0400)
committerR David Murray <rdmurray@bitdance.com>
Tue, 19 Mar 2013 04:00:33 +0000 (00:00 -0400)
Patch by Matt Bachmann.

Lib/test/test_pydoc.py
Misc/ACKS

index d98a526a59aab74dce340667c68c927747184748..aa8baf723ca0df0c2ded1ee473efd97c0b84f86d 100644 (file)
@@ -395,6 +395,31 @@ class PydocDocTest(unittest.TestCase):
             synopsis = pydoc.synopsis(TESTFN, {})
             self.assertEqual(synopsis, 'line 1: h\xe9')
 
+    def test_splitdoc_with_description(self):
+        example_string = "I Am A Doc\n\n\nHere is my description"
+        self.assertEqual(pydoc.splitdoc(example_string),
+                         ('I Am A Doc', '\nHere is my description'))
+
+    def test_is_object_or_method(self):
+        doc = pydoc.Doc()
+        # Bound Method
+        self.assertTrue(pydoc._is_some_method(doc.fail))
+        # Method Descriptor
+        self.assertTrue(pydoc._is_some_method(int.__add__))
+        # String
+        self.assertFalse(pydoc._is_some_method("I am not a method"))
+
+    def test_is_package_when_not_package(self):
+        with test.support.temp_cwd() as test_dir:
+            self.assertFalse(pydoc.ispackage(test_dir))
+
+    def test_is_package_when_is_package(self):
+        with test.support.temp_cwd() as test_dir:
+            init_path = os.path.join(test_dir, '__init__.py')
+            open(init_path, 'w').close()
+            self.assertTrue(pydoc.ispackage(test_dir))
+            os.remove(init_path)
+
 
 class PydocImportTest(unittest.TestCase):
 
index edd736d2b0a05b85471c9f37362112d6fb7b1a29..82cebc78ecc6c38b568c5bee97af1b7fc5b36ef1 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -56,6 +56,7 @@ John Aycock
 Donovan Baarda
 Arne Babenhauserheide
 Attila Babo
+Matt Bachmann
 Marcin Bachry
 Alfonso Baciero
 Dwayne Bailey
@@ -1364,4 +1365,3 @@ Cheng Zhang
 Kai Zhu
 Tarek Ziadé
 Peter Ã…strand
-