Author: ezio.melotti Date: Wed Feb 17 00:32:24 2010 New Revision: 78210 Log: Merged revisions 78209 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r78209 | ezio.melotti | 2010-02-17 01:31:04 +0200 (Wed, 17 Feb 2010) | 9 lines Merged revisions 78207 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r78207 | ezio.melotti | 2010-02-17 01:26:09 +0200 (Wed, 17 Feb 2010) | 1 line #7930: fix stripid ........ ................ Modified: python/branches/release31-maint/ (props changed) python/branches/release31-maint/Lib/pydoc.py python/branches/release31-maint/Lib/test/test_pydoc.py Modified: python/branches/release31-maint/Lib/pydoc.py ============================================================================== --- python/branches/release31-maint/Lib/pydoc.py (original) +++ python/branches/release31-maint/Lib/pydoc.py Wed Feb 17 00:32:24 2010 @@ -123,9 +123,7 @@ def stripid(text): """Remove the hexadecimal id from a Python object representation.""" # The behaviour of %p is implementation-dependent in terms of case. - if _re_stripid.search(repr(Exception)): - return _re_stripid.sub(r'\1', text) - return text + return _re_stripid.sub(r'\1', text) def _is_some_method(obj): return inspect.ismethod(obj) or inspect.ismethoddescriptor(obj) Modified: python/branches/release31-maint/Lib/test/test_pydoc.py ============================================================================== --- python/branches/release31-maint/Lib/test/test_pydoc.py (original) +++ python/branches/release31-maint/Lib/test/test_pydoc.py Wed Feb 17 00:32:24 2010 @@ -302,6 +302,19 @@ expected = missing_pattern % missing_module.strip() self.assertEqual(expected, result) + def test_stripid(self): + # test with strings, other implementations might have different repr() + stripid = pydoc.stripid + # strip the id + self.assertEqual(stripid('<function stripid at 0x88dcee4>'), + '<function stripid>') + self.assertEqual(stripid('<function stripid at 0x01F65390>'), + '<function stripid>') + # nothing to strip, return the same text + self.assertEqual(stripid('42'), '42') + self.assertEqual(stripid("<type 'exceptions.Exception'>"), + "<type 'exceptions.Exception'>") + class TestDescriptions(unittest.TestCase):
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4