summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_pydoc.py
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2012-04-23 17:26:44 (GMT)
committerR David Murray <rdmurray@bitdance.com>2012-04-23 17:26:44 (GMT)
commita82c960c17f4d72ed0e41db58fc6557df40852a0 (patch)
treee053a093127344d6eadc9a2154d11bf90305611a /Lib/test/test_pydoc.py
parentd4404d659c4b7d9a825571cc27707e28aa61251f (diff)
parentc43125a05cc2f942ae8ba372b1dbe2e2e75d446a (diff)
downloadcpython-a82c960c17f4d72ed0e41db58fc6557df40852a0.zip
cpython-a82c960c17f4d72ed0e41db58fc6557df40852a0.tar.gz
cpython-a82c960c17f4d72ed0e41db58fc6557df40852a0.tar.bz2
merge #14638: pydoc now treats non-str __name__ as None instead of raising
Original patch by Peter Otten.
Diffstat (limited to 'Lib/test/test_pydoc.py')
-rw-r--r--Lib/test/test_pydoc.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py
index a9f75b9..8e2001b 100644
--- a/Lib/test/test_pydoc.py
+++ b/Lib/test/test_pydoc.py
@@ -286,6 +286,17 @@ class PydocDocTest(unittest.TestCase):
result, doc_loc = get_pydoc_text(xml.etree)
self.assertEqual(doc_loc, "", "MODULE DOCS incorrectly includes a link")
+ def test_non_str_name(self):
+ # issue14638
+ # Treat illegal (non-str) name like no name
+ class A:
+ __name__ = 42
+ class B:
+ pass
+ adoc = pydoc.render_doc(A())
+ bdoc = pydoc.render_doc(B())
+ self.assertEqual(adoc.replace("A", "B"), bdoc)
+
def test_not_here(self):
missing_module = "test.i_am_not_here"
result = str(run_pydoc(missing_module), 'ascii')