1. Yu-Jie Lin
  2. b.py

Commits

Yu-Jie Lin  committed e35ec6b

remove smartypants Python 3 exception, which now supports Python 3 since v1.7.1

  • Participants
  • Parent commits afc22ec
  • Branches default

Comments (0)

Files changed (4)

File CHANGES.md

View file
  • Ignore whitespace
 
 ## Development
 
+* remove smartypants Python 3 exception, which now supports Python 3 since v1.7.1
+
 ## Version 0.6.0 (2013-08-07T21:40:36Z)
 
 * Port to Python 3, use Unicode in Python 2

File README.md

View file
  • Ignore whitespace
 Text             | None                                               | 2 / 3
 ***Others***
 lnkckr           | [lnkckr][]                                         | 2 / 3
-smartypants      | [smartypants][]                                    | 2
+smartypants      | [smartypants][] >= 1.7.1                           | 2 / 3
 
 [GoogleAPI]: https://developers.google.com/blogger/docs/3.0/api-lib/python
 [python-wordpress-xmlrpc]: https://github.com/maxcutler/python-wordpress-xmlrpc

File bpy/handlers/base.py

View file
  • Ignore whitespace
 from hashlib import md5
 from os.path import basename, splitext
 import re
-import sys
 import warnings
 
 HAS_SMARTYPANTS = False
     >>> handler = Handler(None)
     >>> print(handler.generate('foo "bar"'))
     foo "bar"
-    >>> handler.options['smartypants'] = True # doctest: +SKIP
-    >>> print(handler.generate('foo "bar"')) # doctest: +SKIP
+    >>> handler.options['smartypants'] = True
+    >>> print(handler.generate('foo "bar"'))
     foo “bar”
     """
 
 
     if self.options.get('smartypants', False):
       if not HAS_SMARTYPANTS:
-        if sys.version_info.major == 3:
-          raise NotImplementedError('smartypants is not supported in Python 3')
         warnings.warn("smartypants option is set, "
                       "but the library isn't installed.", RuntimeWarning)
         return html
       pattern = pattern.replace('|script', '|script|style')
       RE = re.compile(pattern, RE.flags)
       smartypants.tags_to_skip_regex = RE
-      html = smartyPants(html)
+      html = smartyPants(html, 'qbdew')
 
     return html
 
     foo "bar"
     >>> print(handler.generate_title('foo\\nbar\\n\\n'))
     foo bar
-    >>> handler.options['smartypants'] = True # doctest: +SKIP
-    >>> print(handler.generate_title('foo "bar"')) # doctest: +SKIP
+    >>> handler.options['smartypants'] = True
+    >>> print(handler.generate_title('foo "bar"'))
     foo “bar”
     """
     if title is None:

File tests/test_bpy_handlers_base.py

View file
  • Ignore whitespace
 
 from __future__ import unicode_literals
 import unittest
-import sys
 
 from bpy.handlers.base import BaseHandler
 
     handler.options['smartypants'] = True
     handler.markup = self.test_smartypants_MARKUP
 
-    if sys.version_info.major == 3:
-      with self.assertRaises(NotImplementedError):
-        html = handler.generate()
-      return
-
     html = handler.generate()
     self.assertEqual(html, self.test_smartypants_EXPECT)
     self.assertIsInstance(html, type(''))