summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu-Jie Lin <livibetter@gmail.com>2013-08-20 10:48:17 +0800
committerYu-Jie Lin <livibetter@gmail.com>2013-08-20 10:48:17 +0800
commitc167a2d01a83a9a87ecd047de2e922a53a1fdf0d (patch)
treef2c633ee03cbd1d19b72eaeaf71657a07b1238cc
parentde5c752f597c71c817fafebe2a76de536e200626 (diff)
parent4ebaffe62fad1a80d2766dab6850ee6e15147a3c (diff)
downloadsmartypants-c167a2d01a83a9a87ecd047de2e922a53a1fdf0d.tar.gz
merge v1.8.1
-rw-r--r--CHANGES.rst5
-rwxr-xr-xsmartypants.py4
-rw-r--r--tests/test.py12
-rw-r--r--tests/test_deprecated.py40
4 files changed, 47 insertions, 14 deletions
diff --git a/CHANGES.rst b/CHANGES.rst
index 82e9eb7..5f15880 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -11,6 +11,11 @@ Versions without timestamps mean they are future releases.
development:
+1.8.1: 2013-08-20T02:27:35Z
+
+ - fix deprecated ``smartyPants`` returns nothing (#2)
+ - add test file for deprecated stuff
+
1.8.0: 2013-08-18T11:47:27Z
- command-line
- add ``--version``
diff --git a/smartypants.py b/smartypants.py
index 59daab6..37fcca3 100755
--- a/smartypants.py
+++ b/smartypants.py
@@ -6,7 +6,7 @@
__author__ = 'Yu-Jie Lin'
__author_email__ = 'livibetter@gmail.com'
-__version__ = '1.8.0'
+__version__ = '1.8.1'
__license__ = 'BSD License'
__url__ = 'https://bitbucket.org/livibetter/smartypants.py'
__description__ = 'Python with the SmartyPants'
@@ -157,7 +157,7 @@ def smartyPants(text, attr=None):
warnings.filterwarnings('once', msg, DeprecationWarning)
warnings.warn(msg, DeprecationWarning)
- smartypants(text, attr)
+ return smartypants(text, attr)
def smartypants(text, attr=None):
diff --git a/tests/test.py b/tests/test.py
index d019f88..549b19f 100644
--- a/tests/test.py
+++ b/tests/test.py
@@ -94,18 +94,6 @@ document.write('<a href="' + href + '">' + linktext + "</a>");
self.assertEqual(sp('"Isn\'t this fun?"'),
'&#8220;Isn&#8217;t this fun?&#8221;')
- def test_deprecated_str_attr(self):
-
- TEXT = '"foo" -- bar'
-
- T = sp(TEXT, 'q')
- E = '&#8220;foo&#8221; -- bar'
- self.assertEquals(T, E)
-
- T = sp(TEXT, 'qd')
- E = '&#8220;foo&#8221; &#8212; bar'
- self.assertEquals(T, E)
-
def load_tests(loader, tests, pattern):
diff --git a/tests/test_deprecated.py b/tests/test_deprecated.py
new file mode 100644
index 0000000..1990f1f
--- /dev/null
+++ b/tests/test_deprecated.py
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+# Copyright (c) 2013 Yu-Jie Lin
+# Licensed under the BSD License, for detailed license information, see COPYING
+
+import unittest
+import warnings
+
+from smartypants import Attr, smartypants as sp, smartyPants as sP
+
+
+class SmartyPantsDeprecatedTestCase(unittest.TestCase):
+
+ def test_str_attr(self):
+
+ TEXT = '"foo" -- bar'
+
+ with warnings.catch_warnings(record=True) as w:
+
+ T = sp(TEXT, 'q')
+ E = '&#8220;foo&#8221; -- bar'
+ self.assertEquals(T, E)
+
+ T = sp(TEXT, 'qd')
+ E = '&#8220;foo&#8221; &#8212; bar'
+ self.assertEquals(T, E)
+
+ # should only get warning 'once'
+ self.assertEquals(len(w), 1)
+
+ def test_smartyPants(self):
+
+ TEXT = '"foo" -- bar'
+
+ with warnings.catch_warnings(record=True) as w:
+
+ T = sP(TEXT, Attr.q)
+ E = '&#8220;foo&#8221; -- bar'
+ self.assertEquals(T, E)
+
+ self.assertEquals(len(w), 1)