[pypy-commit] pypy py3.3: reapply workarounds from py3k branch

pjenvey noreply at buildbot.pypy.org
Sat Jul 26 23:11:16 CEST 2014


Author: Philip Jenvey <pjenvey at underboss.org>
Branch: py3.3
Changeset: r72546:9b1c5ecf653b
Date: 2014-07-26 13:20 -0700
http://bitbucket.org/pypy/pypy/changeset/9b1c5ecf653b/

Log:	reapply workarounds from py3k branch

diff --git a/lib-python/3/test/test_pydoc.py b/lib-python/3/test/test_pydoc.py
--- a/lib-python/3/test/test_pydoc.py
+++ b/lib-python/3/test/test_pydoc.py
@@ -18,7 +18,7 @@
 from collections import namedtuple
 from test.script_helper import assert_python_ok
 from test.support import (
-    TESTFN, rmtree,
+    TESTFN, rmtree, check_impl_detail,
     reap_children, reap_threads, captured_output, captured_stdout,
     captured_stderr, unlink
 )
@@ -105,7 +105,23 @@
 expected_text_data_docstrings = tuple('\n     |      ' + s if s else ''
                                       for s in expected_data_docstrings)
 
-expected_html_pattern = """
+if check_impl_detail(pypy=True):
+    # pydoc_mod.__builtins__ is always a module on PyPy (but a dict on
+    # CPython), hence an extra 'Modules' section
+    module_section = """
+<table width="100%%" cellspacing=0 cellpadding=2 border=0 summary="section">
+<tr bgcolor="#aa55cc">
+<td colspan=3 valign=bottom> <br>
+<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
+    
+<tr><td bgcolor="#aa55cc"><tt>      </tt></td><td> </td>
+<td width="100%%"><table width="100%%" summary="list"><tr><td width="25%%" valign=top><a href="builtins.html">builtins</a><br>
+</td><td width="25%%" valign=top></td><td width="25%%" valign=top></td><td width="25%%" valign=top></td></tr></table></td></tr></table><p>
+"""
+else:
+    module_section = ""
+
+expected_html_pattern = ("""
 <table width="100%%" cellspacing=0 cellpadding=2 border=0 summary="heading">
 <tr bgcolor="#7799ee">
 <td valign=bottom> <br>
@@ -113,7 +129,7 @@
 ><td align=right valign=bottom
 ><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:%s">%s</a>%s</font></td></tr></table>
     <p><tt>This is a test module for test_pydoc</tt></p>
-<p>
+<p>""" + module_section + """\
 <table width="100%%" cellspacing=0 cellpadding=2 border=0 summary="section">
 <tr bgcolor="#ee77aa">
 <td colspan=3 valign=bottom> <br>
@@ -201,7 +217,7 @@
 \x20\x20\x20\x20
 <tr><td bgcolor="#7799ee"><tt>      </tt></td><td> </td>
 <td width="100%%">Nobody</td></tr></table>
-""".strip() # ' <- emacs turd
+""").strip() # ' <- emacs turd
 
 expected_html_data_docstrings = tuple(s.replace(' ', ' ')
                                       for s in expected_data_docstrings)
@@ -433,6 +449,8 @@
 
         # What we expect to get back: everything on object...
         expected = dict(vars(object))
+        # __new__'s descriptor can be a staticmethod on PyPy
+        expected['__new__'] = object.__new__
         # ...plus our unbound method...
         expected['method_returning_true'] = TestClass.method_returning_true
         # ...but not the non-methods on object.


More information about the pypy-commit mailing list