summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorYu-Jie Lin <livibetter@gmail.com>2013-08-16 20:22:43 +0800
committerYu-Jie Lin <livibetter@gmail.com>2013-08-16 20:22:43 +0800
commit205352b9081a92f2d85331e69282a15244a30fb5 (patch)
treed8ae79310e40909bb71c2a33c875e037bef16b9b /tests
parent15f8191c9f7a2dac88c5a6eb2b2886ee72387ff2 (diff)
downloadsmartypants-git-205352b9081a92f2d85331e69282a15244a30fb5.tar.gz
deprecate str-type attr instead of direct removal, which will be removed at v2.0.0. Attr "-1" now is Attr.s (or "s")
a temporary function _str_attr_to_int is added for the transition before v2.0.0.
Diffstat (limited to 'tests')
-rw-r--r--tests/test.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/test.py b/tests/test.py
index c03d647..e2a28c9 100644
--- a/tests/test.py
+++ b/tests/test.py
@@ -1,3 +1,7 @@
+#!/usr/bin/env python
+# Copyright (c) 2013 Yu-Jie Lin
+# Licensed under the BSD License, for detailed license information, see COPYING
+
import doctest
import unittest
@@ -6,7 +10,6 @@ from smartypants import Attr, smartyPants as sp
class TestSmartypantsAllAttributes(unittest.TestCase):
- # the default attribute is "1", which means "all".
def test_dates(self):
@@ -71,6 +74,18 @@ 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):