summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_pydoc.py
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2012-04-23 17:27:11 (GMT)
committerR David Murray <rdmurray@bitdance.com>2012-04-23 17:27:11 (GMT)
commitc313b1d9b0a8afe47fdd58d4685fa3d19ab79e57 (patch)
treea12e865512bc2ca67378b75c1aa0588737d5875d /Lib/test/test_pydoc.py
parent4c20c4e198b0a87f94a814d891ef18bf2d49864a (diff)
downloadcpython-c313b1d9b0a8afe47fdd58d4685fa3d19ab79e57.zip
cpython-c313b1d9b0a8afe47fdd58d4685fa3d19ab79e57.tar.gz
cpython-c313b1d9b0a8afe47fdd58d4685fa3d19ab79e57.tar.bz2
#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 59cbffe..d95e706 100644
--- a/Lib/test/test_pydoc.py
+++ b/Lib/test/test_pydoc.py
@@ -249,6 +249,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 = run_pydoc(missing_module)