summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndi Albrecht <albrecht.andi@gmail.com>2013-01-25 20:29:21 +0100
committerAndi Albrecht <albrecht.andi@gmail.com>2013-01-25 20:29:21 +0100
commit07ef26a1a3b7e2b93d855970b92c985328eef097 (patch)
treecfd761d28191aa993668a40038e033c2259df9fa /tests
parent1584b2225a8d81366ab0298d21b341969c603e8d (diff)
downloadsqlparse-07ef26a1a3b7e2b93d855970b92c985328eef097.tar.gz
Fix a regression where reindent filter failed when comments contained non-ascii chars.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_regressions.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/test_regressions.py b/tests/test_regressions.py
index ba156f0..d6108d5 100644
--- a/tests/test_regressions.py
+++ b/tests/test_regressions.py
@@ -157,3 +157,11 @@ $_$;
ALTER TABLE..... ;"""
t = sqlparse.split(sql)
assert len(t) == 3
+
+
+def test_comment_encoding_when_reindent():
+ # There was an UnicodeEncodeError in the reindent filter that
+ # casted every comment followed by a keyword to str.
+ sql = u'select foo -- Comment containing Ümläuts\nfrom bar'
+ formatted = sqlparse.format(sql, reindent=True)
+ assert formatted == sql