diff options
| author | Andi Albrecht <albrecht.andi@gmail.com> | 2015-12-08 14:49:56 +0100 |
|---|---|---|
| committer | Andi Albrecht <albrecht.andi@gmail.com> | 2015-12-08 14:49:56 +0100 |
| commit | e7a40aa93ca5c599ae269bfaa424e1cdc5cc5ac9 (patch) | |
| tree | c1261c4a52cd80c164c43b8402b96fd8b664003e /tests | |
| parent | 3360f5ddd0efe0bac694ca8e7a4d50b046ccc3f1 (diff) | |
| download | sqlparse-e7a40aa93ca5c599ae269bfaa424e1cdc5cc5ac9.tar.gz | |
Fix version check when casting TokenList to string (fixes #212).
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_regressions.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/test_regressions.py b/tests/test_regressions.py index f873c78..50592c5 100644 --- a/tests/test_regressions.py +++ b/tests/test_regressions.py @@ -7,6 +7,7 @@ from tests.utils import TestCaseBase, load_file import sqlparse from sqlparse import sql from sqlparse import tokens as T +from sqlparse.compat import u class RegressionTests(TestCaseBase): @@ -275,3 +276,13 @@ def test_issue186_get_type(): sql = "-- comment\ninsert into foo" p = sqlparse.parse(sql)[0] assert p.get_type() == 'INSERT' + + +def test_issue212_py2unicode(): + if sys.version_info < (3,): + t1 = sql.Token(T.String, u"schöner ") + else: + t1 = sql.Token(T.String, "schöner ") + t2 = sql.Token(T.String, u"bug") + l = sql.TokenList([t1, t2]) + assert str(l) == 'schöner bug' |
