|
24 | 24 | from io import StringIO |
25 | 25 | from collections import namedtuple |
26 | 26 | from urllib.request import urlopen, urlcleanup |
| 27 | +from test import support |
27 | 28 | from test.support import import_helper |
28 | 29 | from test.support import os_helper |
29 | 30 | from test.support.script_helper import (assert_python_ok, |
@@ -1236,22 +1237,56 @@ def test_bound_builtin_classmethod_o(self): |
1236 | 1237 | self.assertEqual(self._get_summary_line(dict.__class_getitem__), |
1237 | 1238 | "__class_getitem__(object, /) method of builtins.type instance") |
1238 | 1239 |
|
| 1240 | + @support.cpython_only |
1239 | 1241 | def test_module_level_callable_unrepresentable_default(self): |
1240 | | - self.assertEqual(self._get_summary_line(getattr), |
1241 | | - "getattr(...)") |
| 1242 | + import _testcapi |
| 1243 | + builtin = _testcapi.func_with_unrepresentable_signature |
| 1244 | + self.assertEqual(self._get_summary_line(builtin), |
| 1245 | + "func_with_unrepresentable_signature(a, b=<x>)") |
1242 | 1246 |
|
| 1247 | + @support.cpython_only |
1243 | 1248 | def test_builtin_staticmethod_unrepresentable_default(self): |
1244 | 1249 | self.assertEqual(self._get_summary_line(str.maketrans), |
1245 | 1250 | "maketrans(x, y=<unrepresentable>, z=<unrepresentable>, /)") |
| 1251 | + import _testcapi |
| 1252 | + cls = _testcapi.DocStringUnrepresentableSignatureTest |
| 1253 | + self.assertEqual(self._get_summary_line(cls.staticmeth), |
| 1254 | + "staticmeth(a, b=<x>)") |
1246 | 1255 |
|
| 1256 | + @support.cpython_only |
1247 | 1257 | def test_unbound_builtin_method_unrepresentable_default(self): |
1248 | 1258 | self.assertEqual(self._get_summary_line(dict.pop), |
1249 | 1259 | "pop(self, key, default=<unrepresentable>, /)") |
| 1260 | + import _testcapi |
| 1261 | + cls = _testcapi.DocStringUnrepresentableSignatureTest |
| 1262 | + self.assertEqual(self._get_summary_line(cls.meth), |
| 1263 | + "meth(self, /, a, b=<x>)") |
1250 | 1264 |
|
| 1265 | + @support.cpython_only |
1251 | 1266 | def test_bound_builtin_method_unrepresentable_default(self): |
1252 | 1267 | self.assertEqual(self._get_summary_line({}.pop), |
1253 | 1268 | "pop(key, default=<unrepresentable>, /) " |
1254 | 1269 | "method of builtins.dict instance") |
| 1270 | + import _testcapi |
| 1271 | + obj = _testcapi.DocStringUnrepresentableSignatureTest() |
| 1272 | + self.assertEqual(self._get_summary_line(obj.meth), |
| 1273 | + "meth(a, b=<x>) " |
| 1274 | + "method of _testcapi.DocStringUnrepresentableSignatureTest instance") |
| 1275 | + |
| 1276 | + @support.cpython_only |
| 1277 | + def test_unbound_builtin_classmethod_unrepresentable_default(self): |
| 1278 | + import _testcapi |
| 1279 | + cls = _testcapi.DocStringUnrepresentableSignatureTest |
| 1280 | + descr = cls.__dict__['classmeth'] |
| 1281 | + self.assertEqual(self._get_summary_line(descr), |
| 1282 | + "classmeth(type, /, a, b=<x>)") |
| 1283 | + |
| 1284 | + @support.cpython_only |
| 1285 | + def test_bound_builtin_classmethod_unrepresentable_default(self): |
| 1286 | + import _testcapi |
| 1287 | + cls = _testcapi.DocStringUnrepresentableSignatureTest |
| 1288 | + self.assertEqual(self._get_summary_line(cls.classmeth), |
| 1289 | + "classmeth(a, b=<x>) method of builtins.type instance") |
1255 | 1290 |
|
1256 | 1291 | def test_overridden_text_signature(self): |
1257 | 1292 | class C: |
|
0 commit comments