@@ -419,6 +419,7 @@ def call_url_handler(self, url, expected_title):
419419
420420
421421class PydocDocTest (unittest .TestCase ):
422+ maxDiff = None
422423
423424 @unittest .skipIf (sys .flags .optimize >= 2 ,
424425 "Docstrings are omitted with -O2 and above" )
@@ -650,6 +651,104 @@ def method_returning_true(self):
650651 methods = pydoc .allmethods (TestClass )
651652 self .assertDictEqual (methods , expected )
652653
654+ def test_method_aliases (self ):
655+ class A :
656+ def tkraise (self , aboveThis = None ):
657+ """Raise this widget in the stacking order."""
658+ lift = tkraise
659+ def a_size (self ):
660+ """Return size"""
661+ class B (A ):
662+ def itemconfigure (self , tagOrId , cnf = None , ** kw ):
663+ """Configure resources of an item TAGORID."""
664+ itemconfig = itemconfigure
665+ b_size = A .a_size
666+
667+ doc = pydoc .render_doc (B )
668+ # clean up the extra text formatting that pydoc performs
669+ doc = re .sub ('\b .' , '' , doc )
670+ self .assertEqual (doc , '''\
671+ Python Library Documentation: class B in module %s
672+
673+ class B(A)
674+ | Method resolution order:
675+ | B
676+ | A
677+ | builtins.object
678+ |\x20 \x20
679+ | Methods defined here:
680+ |\x20 \x20
681+ | b_size = a_size(self)
682+ |\x20 \x20
683+ | itemconfig = itemconfigure(self, tagOrId, cnf=None, **kw)
684+ |\x20 \x20
685+ | itemconfigure(self, tagOrId, cnf=None, **kw)
686+ | Configure resources of an item TAGORID.
687+ |\x20 \x20
688+ | ----------------------------------------------------------------------
689+ | Methods inherited from A:
690+ |\x20 \x20
691+ | a_size(self)
692+ | Return size
693+ |\x20 \x20
694+ | lift = tkraise(self, aboveThis=None)
695+ |\x20 \x20
696+ | tkraise(self, aboveThis=None)
697+ | Raise this widget in the stacking order.
698+ |\x20 \x20
699+ | ----------------------------------------------------------------------
700+ | Data descriptors inherited from A:
701+ |\x20 \x20
702+ | __dict__
703+ | dictionary for instance variables (if defined)
704+ |\x20 \x20
705+ | __weakref__
706+ | list of weak references to the object (if defined)
707+ ''' % __name__ )
708+
709+ doc = pydoc .render_doc (B , renderer = pydoc .HTMLDoc ())
710+ self .assertEqual (doc , '''\
711+ Python Library Documentation: class B in module %s
712+
713+ <p>
714+ <table width="100%%" cellspacing=0 cellpadding=2 border=0 summary="section">
715+ <tr bgcolor="#ffc8d8">
716+ <td colspan=3 valign=bottom> <br>
717+ <font color="#000000" face="helvetica, arial"><a name="B">class <strong>B</strong></a>(A)</font></td></tr>
718+ \x20 \x20 \x20 \x20
719+ <tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td>
720+ <td width="100%%"><dl><dt>Method resolution order:</dt>
721+ <dd>B</dd>
722+ <dd>A</dd>
723+ <dd><a href="builtins.html#object">builtins.object</a></dd>
724+ </dl>
725+ <hr>
726+ Methods defined here:<br>
727+ <dl><dt><a name="B-b_size"><strong>b_size</strong></a> = <a href="#B-a_size">a_size</a>(self)</dt></dl>
728+
729+ <dl><dt><a name="B-itemconfig"><strong>itemconfig</strong></a> = <a href="#B-itemconfigure">itemconfigure</a>(self, tagOrId, cnf=None, **kw)</dt></dl>
730+
731+ <dl><dt><a name="B-itemconfigure"><strong>itemconfigure</strong></a>(self, tagOrId, cnf=None, **kw)</dt><dd><tt>Configure resources of an item TAGORID.</tt></dd></dl>
732+
733+ <hr>
734+ Methods inherited from A:<br>
735+ <dl><dt><a name="B-a_size"><strong>a_size</strong></a>(self)</dt><dd><tt>Return size</tt></dd></dl>
736+
737+ <dl><dt><a name="B-lift"><strong>lift</strong></a> = <a href="#B-tkraise">tkraise</a>(self, aboveThis=None)</dt></dl>
738+
739+ <dl><dt><a name="B-tkraise"><strong>tkraise</strong></a>(self, aboveThis=None)</dt><dd><tt>Raise this widget in the stacking order.</tt></dd></dl>
740+
741+ <hr>
742+ Data descriptors inherited from A:<br>
743+ <dl><dt><strong>__dict__</strong></dt>
744+ <dd><tt>dictionary for instance variables (if defined)</tt></dd>
745+ </dl>
746+ <dl><dt><strong>__weakref__</strong></dt>
747+ <dd><tt>list of weak references to the object (if defined)</tt></dd>
748+ </dl>
749+ </td></tr></table>\
750+ ''' % __name__ )
751+
653752
654753class PydocImportTest (PydocBaseTest ):
655754
0 commit comments