From: Oleg Broytman Date: Mon, 26 Sep 2016 21:54:23 +0000 (+0300) Subject: Add a test for print_tokens() X-Git-Tag: 0.0.7~2 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=2b8ee2f51e148fd5ffb1ff41143c50c1fa8e815d;p=sqlconvert.git Add a test for print_tokens() --- diff --git a/ChangeLog b/ChangeLog index d84b637..7a15d54 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,8 @@ Version 0.0.7 (2016-09-??) Change quoting style to MySQL, PostgreSQL or SQLite. + Add a test for print_tokens(). + Version 0.0.6 (2016-09-25) Condense a sequence of newlines after a /*! directive */; diff --git a/tests/test_print_tokens.py b/tests/test_print_tokens.py new file mode 100644 index 0000000..af9c9ae --- /dev/null +++ b/tests/test_print_tokens.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- + +try: + from cStringIO import StringIO +except ImportError: + try: + from StringIO import StringIO + except ImportError: + from io import StringIO + +from sqlparse import parse +from sqlconvert.print_tokens import print_tokens + + +def test_print_tokens(): + sio = StringIO() + parsed = parse("select * from T")[0] + print_tokens(parsed, outfile=sio) + assert sio.getvalue() == u"SELECT * FROM T"