diff options
author | Yu-Jie Lin <livibetter@gmail.com> | 2013-08-20 10:27:29 +0800 |
---|---|---|
committer | Yu-Jie Lin <livibetter@gmail.com> | 2013-08-20 10:27:29 +0800 |
commit | 5bb74b2af16a4834f27e53c1eec4dc9b5bddd745 (patch) | |
tree | a4a821add880df2771698faeb8ce718bb462abbc /tests | |
parent | d7c010822addabf276b2a61ba18a35f1651db2d5 (diff) | |
download | smartypants-5bb74b2af16a4834f27e53c1eec4dc9b5bddd745.tar.gz |
fix deprecated smartyPants() returns nothing, add test file for deprecated stuff. fix #2
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test.py | 12 | ||||
-rw-r--r-- | tests/test_deprecated.py | 40 |
2 files changed, 40 insertions, 12 deletions
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?"'), '“Isn’t this fun?”') - def test_deprecated_str_attr(self): - - TEXT = '"foo" -- bar' - - T = sp(TEXT, 'q') - E = '“foo” -- bar' - self.assertEquals(T, E) - - T = sp(TEXT, 'qd') - E = '“foo” — 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 = '“foo” -- bar' + self.assertEquals(T, E) + + T = sp(TEXT, 'qd') + E = '“foo” — 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 = '“foo” -- bar' + self.assertEquals(T, E) + + self.assertEquals(len(w), 1) |