MCPcopy Index your code
hub / github.com/python/cpython / test_method_aliases

Method test_method_aliases

Lib/test/test_pydoc/test_pydoc.py:1073–1160  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1071
1072 @requires_docstrings
1073 def test_method_aliases(self):
1074 class A:
1075 def tkraise(self, aboveThis=None):
1076 """Raise this widget in the stacking order."""
1077 lift = tkraise
1078 def a_size(self):
1079 """Return size"""
1080 class B(A):
1081 def itemconfigure(self, tagOrId, cnf=None, **kw):
1082 """Configure resources of an item TAGORID."""
1083 itemconfig = itemconfigure
1084 b_size = A.a_size
1085
1086 doc = pydoc.render_doc(B)
1087 doc = clean_text(doc)
1088 self.assertEqual(doc, '''\
1089Python Library Documentation: class B in module %s
1090
1091class B(A)
1092 | Method resolution order:
1093 | B
1094 | A
1095 | builtins.object
1096 |
1097 | Methods defined here:
1098 |
1099 | b_size = a_size(self)
1100 |
1101 | itemconfig = itemconfigure(self, tagOrId, cnf=None, **kw)
1102 |
1103 | itemconfigure(self, tagOrId, cnf=None, **kw)
1104 | Configure resources of an item TAGORID.
1105 |
1106 | ----------------------------------------------------------------------
1107 | Methods inherited from A:
1108 |
1109 | a_size(self)
1110 | Return size
1111 |
1112 | lift = tkraise(self, aboveThis=None)
1113 |
1114 | tkraise(self, aboveThis=None)
1115 | Raise this widget in the stacking order.
1116 |
1117 | ----------------------------------------------------------------------
1118 | Data descriptors inherited from A:
1119 |
1120 | __dict__
1121 | dictionary for instance variables
1122 |
1123 | __weakref__
1124 | list of weak references to the object
1125''' % __name__)
1126
1127 doc = pydoc.render_doc(B, renderer=pydoc.HTMLDoc())
1128 expected_text = f"""
1129Python Library Documentation
1130

Callers

nothing calls this directly

Calls 6

clean_textFunction · 0.85
html2textFunction · 0.85
assertInMethod · 0.80
assertEqualMethod · 0.45
stripMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected