[Python-checkins] r88893 - in tracker/instances/python-dev/extensions: local_replace.py test/local_replace_data.txt test/test_local_replace.py

ezio.melotti python-checkins at python.org
Sun Sep 4 16:27:48 CEST 2011


Author: ezio.melotti
Date: Sun Sep  4 16:27:48 2011
New Revision: 88893

Log:
Tweak PEP regex to prevent linkification in URLs.

Modified:
   tracker/instances/python-dev/extensions/local_replace.py
   tracker/instances/python-dev/extensions/test/local_replace_data.txt
   tracker/instances/python-dev/extensions/test/test_local_replace.py

Modified: tracker/instances/python-dev/extensions/local_replace.py
==============================================================================
--- tracker/instances/python-dev/extensions/local_replace.py	(original)
+++ tracker/instances/python-dev/extensions/local_replace.py	Sun Sep  4 16:27:48 2011
@@ -98,7 +98,7 @@
      make_traceback_link),
 
     # PEP 8, PEP8, PEP 0008, ...
-    (re.compile(r'\b(?<!/)PEP\s*(\d{1,4})\b', re.I),
+    (re.compile(r'\b(?<![/=-])PEP\s*(\d{1,4})(?!/)\b', re.I),
      make_pep_link),
 
     # devguide

Modified: tracker/instances/python-dev/extensions/test/local_replace_data.txt
==============================================================================
--- tracker/instances/python-dev/extensions/test/local_replace_data.txt	(original)
+++ tracker/instances/python-dev/extensions/test/local_replace_data.txt	Sun Sep  4 16:27:48 2011
@@ -192,6 +192,14 @@
 write a PEP!
 http://wiki.python.org/moin/SummerOfCode/2011/PEP393
 <a href="http://wiki.python.org/moin/SummerOfCode/2011/PEP393">http://wiki.python.org/moin/SummerOfCode/2011/PEP393</a>
+see https://bitbucket.org/rndblnch/cpython-pep380/raw/tip/pep380
+see <a href="https://bitbucket.org/rndblnch/cpython-pep380/raw/tip/pep380">https://bitbucket.org/rndblnch/cpython-pep380/raw/tip/pep380</a>
+see https://bitbucket.org/rndblnch/cpython-pep380/qseries?apply=t&qs_apply=pep380
+see <a href="https://bitbucket.org/rndblnch/cpython-pep380/qseries?apply=t&amp;qs_apply=pep380">https://bitbucket.org/rndblnch/cpython-pep380/qseries?apply=t&amp;qs_apply=pep380</a>
+see https://bitbucket.org/rndblnch/cpython-pep380/wiki
+see <a href="https://bitbucket.org/rndblnch/cpython-pep380/wiki">https://bitbucket.org/rndblnch/cpython-pep380/wiki</a>
+see http://www.python.org/dev/peps/pep-0008/
+see <a href="http://www.python.org/dev/peps/pep-0008/">http://www.python.org/dev/peps/pep-0008/</a>
 ##
 ##
 see the devguide.

Modified: tracker/instances/python-dev/extensions/test/test_local_replace.py
==============================================================================
--- tracker/instances/python-dev/extensions/test/test_local_replace.py	(original)
+++ tracker/instances/python-dev/extensions/test/test_local_replace.py	Sun Sep  4 16:27:48 2011
@@ -59,7 +59,9 @@
                 continue  # skip the comments
             p = PyDevStringHTMLProperty(self.client, 'test', '1',
                                         None, 'test', text)
-            self.assertEqual(p.pydev_hyperlinked(), expected_result)
+            # decode the str -- Unicode strings have a better diff
+            self.assertEqual(p.pydev_hyperlinked().decode(),
+                             expected_result.decode())
 
 # run the tests
 unittest.main()


More information about the Python-checkins mailing list